Skip to content

Instantly share code, notes, and snippets.

@robertjpayne
Created January 5, 2016 12:12
Show Gist options
  • 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