Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Is RxSwift for me? @ try! Swift NYC

Marin Todorov
September 03, 2016

Is RxSwift for me? @ try! Swift NYC

It's difficult to make the jump from map and filter to say ... presenting view controllers or search bars that need to call an API on the web and populate a table view. To be honest, at first it seems almost like functional or reactive programming has nothing to do with UIKit or NSURLSession...

In this talk Marin (me) will show you how RxSwift (an async, event based framework) applies in few every day situations of the life of an iOS developer. If you like major pains being solved for you transparently at the price of a single dependance this talk is for you.

Marin Todorov

September 03, 2016
Tweet

More Decks by Marin Todorov

Other Decks in Technology

Transcript

  1. I create iOS apps -

    is RxSwift for me?
    try! Swift NYC
    Marin Todorov
    [email protected]

    View Slide

  2. An async, event
    based framework
    [email protected]

    View Slide

  3. The reactive side of
    Rx
    [email protected]

    View Slide

  4. Array
    [email protected]
    0 first
    1 second
    2 third

    View Slide

  5. [email protected]
    0 first
    1 second
    2 third
    3 fourth

    View Slide

  6. [email protected]
    0 first
    1 second
    2 third
    3 fourth

    View Slide

  7. [email protected]
    0 first
    1 second
    2 third
    Image Credit: NASA Goddard Space Flight Center

    View Slide

  8. Observable>
    [email protected]
    0 first
    1 second
    2 third
    3 fourth
    4 fifth
    Not an actual Rx code

    View Slide

  9. [email protected]
    0 first
    1 second
    2 third
    0 first
    1 second
    2 third
    3 fourth
    0 first
    1 second
    2 third
    3 fourth
    4 fifth

    View Slide

  10. [email protected]
    Pending number: fif
    fif
    Pending number: fift
    fift
    Pending number: fifth
    fifth

    View Slide

  11. View Slide

  12. The functional side of
    Rx
    [email protected]

    View Slide

  13. [email protected]
    Pending number: fif
    fif
    Observable
    0 first
    1 second
    2 third
    3 fourth
    Observable> Observable

    View Slide

  14. [email protected]
    marin
    Observable
    filter
    length > 3
    Observable
    debounce
    interval > 0.5s
    Observable
    flatMapLatest
    NSData
    Observable
    map
    Array
    Observable>
    map
    NSURLRequest(…)
    Observable
    map
    Repo(…)
    Observable>

    View Slide

  15. View Slide

  16. F&R App Architecture
    [email protected]

    View Slide

  17. View Slide

  18. View Slide

  19. [email protected]
    ViewModel
    RxSwift Code
    RxSwift Code
    ViewModel
    MVVM
    RxTests
    Binding Code Binding Code

    View Slide

  20. RxSwift
    1. Sync-like async code
    2. With a functional aspect
    3. That encourages good architecture
    [email protected]

    View Slide

  21. We’re hiring
    [email protected]
    • iOS Evangelist
    • Android Evangelist
    • C++ Core
    • Javascript
    • Automation Engineer
    • C# Engineer
    • Product Manager
    • and much more!
    realm.io/jobs

    View Slide

  22. [email protected]
    Further Reading & Credits
    http://reactivex.io (RxSwift, RxJava, RxJS, …)
    http://rxswift.org (links to GitHub)
    http://rx-marin.com
    Thanks : Ash Furrow, Jens Ravens, Florent
    Pillet, Junior Bontognali, Krunoslav Zaher

    View Slide

  23. [email protected]
    Questions?
    Marin Todorov
    [email protected]
    www.realm.io
    @icanzilb

    View Slide