You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

22 lines
544 B

//
// unwrap+SharedSequence.swift
// RxSwiftExt
//
// Created by Hugo Saynac on 05/10/2018.
// Copyright © 2018 RxSwift Community. All rights reserved.
//
import RxCocoa
extension SharedSequence {
/**
Takes a SharedSequence of optional elements and returns a SharedSequence of non-optional elements, filtering out any nil values.
- returns: A SharedSequence of non-optional elements
*/
public func unwrap<T>() -> SharedSequence<S, T> where E == T? {
return self.filter { $0 != nil }.map { $0! }
}
}