Documents `<->` internals better.

This commit is contained in:
Krunoslav Zaher 2016-06-14 23:44:44 +02:00
parent 49ccdac810
commit 96b269dc5f
1 changed files with 12 additions and 1 deletions

View File

@ -51,8 +51,19 @@ func <-> (textInput: RxTextInput, variable: Variable<String>) -> Disposable {
let nonMarkedTextValue = nonMarkedText(textInput)
if nonMarkedTextValue != nil && nonMarkedTextValue != variable.value {
/**
In some cases `textInput.textRangeFromPosition(start, toPosition: end)` will return nil even though the underlying
value is not nil. This appears to be an Apple bug. If it's not, and we are doing something wrong, please let us know.
The can be reproed easily if replace bottom code with
if nonMarkedTextValue != variable.value {
variable.value = nonMarkedTextValue ?? ""
}
and you hit "Done" button on keyboard.
*/
if let nonMarkedTextValue = nonMarkedTextValue where nonMarkedTextValue != variable.value {
variable.value = nonMarkedTextValue
}
}, onCompleted: {
bindToUIDisposable.dispose()