Last active
March 1, 2019 13:21
-
-
Save darrarski/d465b37bccd1f0263d8678daf185311e to your computer and use it in GitHub Desktop.
RxCocoa Driver Unwrap Operator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import RxCocoa | |
extension Driver { | |
func unwrap<T>() -> Driver<T> where E == T? { | |
// swiftlint:disable:next force_unwrapping | |
return filter { $0 != nil }.map { $0! }.asDriver(onErrorDriveWith: .empty()) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment