Slide 1

Slide 1 text

RxSwift Introduction to reactive programming Kristaps Grinbergs @fassko

Slide 2

Slide 2 text

RxSwift isn't KVO, ReactNative or ReactJS

Slide 3

Slide 3 text

About me ● Swift developer at Qminder ● BCompSci & MComSci unfinished DmCompSci ● > 15 years in IT ● love open source

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

Agenda ● What is Rx ● RxSwift and building blocks ● Examples ● Pros and Cons

Slide 7

Slide 7 text

Imperative programming ● Saved state ● Order of execution ● Side effects

Slide 8

Slide 8 text

In computing, reactive programming is a programming paradigm oriented around data flows and the propagation of change. Wikipedia

Slide 9

Slide 9 text

Reactive programming is programming with asynchronous data streams

Slide 10

Slide 10 text

Reactive programming ● Asynchronous ● No saved state ● Functional ● Responsive

Slide 11

Slide 11 text

ReactiveX An API for asynchronous programming with observable streams. ● Microsoft (Rx.NET) - 2009 ● Supports many languages ● RxSwift - 2015

Slide 12

Slide 12 text

Rx components ● Observable ● Observers ● Schedulers

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

Observables Completed and Error will terminate the stream Next Completed Error

Slide 17

Slide 17 text

Operators Filtering Transforming Combining

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

RxMarbles.com

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

UI bindings RxCocoa

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

Testing ● Async XCTest with expectations ● RxBlocking making it synchronous ● Using RxTest and custom Schedulers ● https://www.raywenderlich.com/7408-testing-your-rxswift-code ● https://www.youtube.com/watch?v=FgbTenGH-P0

Slide 28

Slide 28 text

+ Agile and reusable code Thread safety Eliminate state from code Testing Well tested Error handling Large community and extensions Extends MVVM

Slide 29

Slide 29 text

- Steep learning curve Change previous practices Debugging Testing Over-reactive Overhead

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

Resources ● http://reactivex.io/ ● https://github.com/ReactiveX/RxSwift ● https://github.com/RxSwiftCommunity ● http://adamborek.com/ ● http://rx-marin.com/ ● RayWenderlich RxSwift book ● Shai Michal presentations

Slide 33

Slide 33 text

No content