Skip to content

Instantly share code, notes, and snippets.

@darrarski
Last active March 1, 2019 13:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darrarski/d465b37bccd1f0263d8678daf185311e to your computer and use it in GitHub Desktop.
Save darrarski/d465b37bccd1f0263d8678daf185311e to your computer and use it in GitHub Desktop.
RxCocoa Driver Unwrap Operator
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