Skip to content

Instantly share code, notes, and snippets.

@joshavant
Last active July 9, 2016 02:36
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 joshavant/b9cb036f8b1543123aaed5e165b3b34c to your computer and use it in GitHub Desktop.
Save joshavant/b9cb036f8b1543123aaed5e165b3b34c to your computer and use it in GitHub Desktop.
if context == &FooKVOContext {
// .CGSizeValue can cause a sneaky segfault here, because it will execute on ALL keyPaths (not just "contentSize")
if let newContentSize = change?[NSKeyValueChangeNewKey]?.CGSizeValue() where keyPath == "contentSize" {
// do things
}
} else {
super.observeValueForKeyPath(keyPath, ofObject: object, change: change, context: context)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment