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

Five Unbelievable Secrets of Reactive Programmi...

Greg Heo
February 24, 2017

Five Unbelievable Secrets of Reactive Programming the Experts Don't Want You to Know!

Totally non-clickbaity article about lessons learned from reactive programming. Presented at Playgrounds, Melbourne, February 24, 2917.

Greg Heo

February 24, 2017
Tweet

More Decks by Greg Heo

Other Decks in Technology

Transcript

  1. .map({ (point: NSPoint) -> Int in for (i, squareView) in

    squareViews.enumerated() { if squareView.frame.contains(point) { return i } } }) vc.rx_mouseClicks an observable (aka a sequence) 0 1 2 3 4 5 6 7 8
  2. gameController.resultObservable .subscribe(onNext: { moveResult in switch moveResult { case .win(let

    winner): let alert = NSAlert()
 // Show alert for winner case .draw: let alert = NSAlert()
 // Show alert for draw case .success(nextPlayer: player):
 // ... case .invalid(nextPlayer: player): // ... } })
  3. Game
 controller let moves: [Int] = [1, 3, 52, 4]

    [.success(nextPlayer: .nought), .success(nextPlayer: .cross), .success(nextPlayer: .nought)] .invalid(nextPlayer: .cross),
  4. 1. You already know it 2. Sequences everywhere 3. Small

    pieces of logic 4. Declarative style 5. Testable code