Skip to content

Instantly share code, notes, and snippets.

@robertjpayne
Created January 5, 2016 12:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robertjpayne/6ca07f26a8da6053148f to your computer and use it in GitHub Desktop.
Save robertjpayne/6ca07f26a8da6053148f to your computer and use it in GitHub Desktop.
let _name = Observable<String>("Hello")
var name: ObservableOf<String> {
return ObservableOf(self._name)
}
var scope: NSString? = "Yeehaw"
self.name.observe { (oldValue, newValue) -> Void in
print("\(oldValue) => \(newValue)")
}.scopeTo(scope!)
self._name.value = "Payne"
scope = nil
self._name.value = "Scope was deallocd so this wont be called"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment