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

Functional Reactive Programming in Swift

Functional Reactive Programming in Swift

一次在知乎 iOS 组的内部分享

X140Yu

May 26, 2017
Tweet

More Decks by X140Yu

Other Decks in Programming

Transcript

  1. FRP Functional Reactive first class and higher-order functions pure functions

    asynchronous data streams touch event, KVO, Notification, callback, Network response,timer
  2. Stream Like a pipe, if you missed the thing through

    it, it's gone forever Like an Array, it can hold anything Unlike an Array, you can't access it anytime you want, instread, you get notified when it's value get changed
  3. Transform Higher-order functions, map, filter, reduce, flatMap, etc Change a

    stream to another stream, just like change a sequence to another Write our own version of there functions!
  4. Functional Reactive + + Swift Improve productivity Less and more

    centralised code Easy to maintain Good Bad Learning curve is steep, but not that steep Debug may be difficult Change the way you think when coding Avoid complexity with mutable state growing over time
  5. How