Skip to content

Instantly share code, notes, and snippets.

@tolpp
Last active October 2, 2015 14:23
Show Gist options
  • Save tolpp/5435f4bca1cb079aa9bf to your computer and use it in GitHub Desktop.
Save tolpp/5435f4bca1cb079aa9bf to your computer and use it in GitHub Desktop.
import ObjectiveC
private var xoAssociationKey: UInt8 = 0
extension UIView {
var xo: PFObject! {
get {
return objc_getAssociatedObject(self, &xoAssociationKey) as? PFObject
}
set(newValue) {
objc_setAssociatedObject(self, &xoAssociationKey, newValue, objc_AssociationPolicy(OBJC_ASSOCIATION_RETAIN))
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment