Skip to content
Permalink
Browse files

[feature/isSecureTextEntryBinder] implement UITextField isSecureTextE…

…ntry binder
  • Loading branch information...
MortyMerr authored and kzaher committed May 9, 2019
1 parent 38e7d85 commit 70b8a33c5c3f4c3b15ebf10b638d2b15cfafb814
Showing with 17 additions and 0 deletions.
  1. +7 −0 RxCocoa/iOS/UITextField+Rx.swift
  2. +10 −0 Tests/RxCocoaTests/UITextField+RxTests.swift
@@ -50,6 +50,13 @@ extension Reactive where Base: UITextField {
}
)
}

/// Bindable sink for `isSecureTextEntry` property.
public var isSecureTextEntry: Binder<Bool> {
return Binder(self.base) { textField, isSecureTextEntry in
textField.isSecureTextEntry = isSecureTextEntry
}
}

}

@@ -46,6 +46,16 @@ final class UITextFieldTests : RxTest {
XCTAssertEqual(textField.attributedText!, attributedText)
}
}

func test_isSecureTextEntryObserver() {
// because of leak in iOS 11.2
if #available(iOS 11.3, tvOS 11.3, *) {
let textField = UITextField()
XCTAssertFalse(textField.isSecureTextEntry)
textField.rx.isSecureTextEntry.onNext(true)
XCTAssertTrue(textField.isSecureTextEntry)
}
}
}

private extension String {

0 comments on commit 70b8a33

Please sign in to comment.
You can’t perform that action at this time.