Skip to content

Instantly share code, notes, and snippets.

@pepicrft
Created July 20, 2016 06:57
Show Gist options
  • Select an option

  • Save pepicrft/a53455f99e7d19aadaf7676f3a01fd0b to your computer and use it in GitHub Desktop.

Select an option

Save pepicrft/a53455f99e7d19aadaf7676f3a01fd0b to your computer and use it in GitHub Desktop.
class AppDelegate {
func observeUserSession() {
let sessionObserver = SessionObserver(name: "my-service")
sessionObserver
.map { $0 != nil }
.distinctUntilChanged()
.subscribeNext { [weak self] authenticated in
if authenticated {
self?.showLogin()
} else {
self?.showApp()
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment