Examples

    1. Simple UI bindings
    2. more examples

    Here is the imperative code that calculates the value of c:

    The value of c is now . However, if we change the value of a to 4, c will still contain the old value.

    This is the improved logic using RxSwift:

    • Instead of binding to variables, let’s bind to UITextField values using the property
    • Next, map the String into an Int and determine if the number is prime using an async API
    • If the text is changed before the async call completes, a new async call will replace it via concat

    All of the operators used in this example are the same operators used in the first example with variables. There’s nothing special about it.

    This example contains complex async UI validation logic with progress notifications.
    All operations are cancelled the moment disposeBag is deallocated.

    Let’s give it a shot.

    They include examples on how to use Rx in the context of MVVM pattern or without it.