Skip to content

Instantly share code, notes, and snippets.

@twittemb
Created March 19, 2020 20:47
Show Gist options
  • Save twittemb/0c3b2477cb0555fca57b4b335e0eea5e to your computer and use it in GitHub Desktop.
Save twittemb/0c3b2477cb0555fca57b4b335e0eea5e to your computer and use it in GitHub Desktop.
// previously defined or injected: counterSpin is the Spin that handles our counter rules
self.uiSpin = UISpin(spin: counterSpin)
// self.uiSpin is now able to handle UI side effects
// we now want to attach the UI Spin to the rendering function of the ViewController:
self.uiSpin.render(on: self, using: { $0.render(state:) })
// And once the view is ready (in “viewDidLoad” function for instance) let’s start the loop:
self.uiSpin.start()
// the underlying reactive stream will be disposed once the uiSpin will be deinit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment