Advanced Patterns for Functional Reactive Programming in Swift

Sebastian Grail, CanvaPart of DW16

Functional Reactive Programming is an immensly useful tool to write asynchronous code at a higher abstraction level. Unfortunately the learning curve is extremely steep and the few tutorials for advanced concepts are often quite academical. Often people only use a small subset of the avaialbe API and resort to writing stateful, imperative code that could otherwise be expressed more functionally.

In this talk, I’ll introduce some advanced patterns for:

  • state management
  • synchronising work
  • complex flow control

All examples are lifted straight out of our production code base and provide simple recipes for problems, that often require a complex interaction of multiple methods and mutable state in a traditional object oriented approach.

Reactive Cocoa (https://github.com/ReactiveCocoa/ReactiveCocoa) is a popular FRP framework for the Apple platform that provides a Swift interface and comes with binding for many UIKit elements. Examples will be given for Reactive Cocoa but are applicable across most popular FRP frameworks.



Sebastian is a mobile developer at Canva where he confuses his colleagues by running a vim plugin in Xcode. In his quest to write better code he likes to look for answers in maths, functional programming and pictures of cats on the internet.