Skip to content

Remove .distinctUntilChanged() in UIControl.rx_value #626

Closed
@RobinFalko

Description

rx_value in extension UIControl (RxCocoa.UIControl+Rx.swift) shouldn't call .distinctUntilChanged() since it manipulates the native event behavior of a UIControl. Imho it should be up to the developer to call .distinctUntilChanged() or not.

E.g. the developer wants to limit the character input within a UITextField, .distinctUntilChanged() will prevent the developer from manipulating the input from every second event if the second content is equal to the previous content because the second event won't be dispatched at all.

textField.rx_text
            .map { text in
                text = [remove special characters from 'text' and assign the result to 'text' again]
                return text
            }
            .bindTo(textField.rx_text)
            .addDisposableTo(disposeBag)

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions