Created
February 3, 2018 06:46
-
-
Save ktanaka117/0e71a3378d8d3fc1bc33f96da4aa18d5 to your computer and use it in GitHub Desktop.
RxのUITextField.textをunwrapしてくれる君。
This file contains hidden or 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 RxSwift | |
import RxCocoa | |
extension Reactive where Base: UITextField { | |
var nonOptionalText: Observable<String> { | |
return base.rx.text.asObservable().map { text -> String in | |
if let _ = text { | |
return text! | |
} | |
return "" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment