extension UIButton {
private struct AssociatedKeys {
static var indexPath:NSIndexPath?
}
var indexPath: NSIndexPath? {
get {
return objc_getAssociatedObject(self, &AssociatedKeys.indexPath) as? NSIndexPath
}
set {
if let newValue = newValue {
objc_setAssociatedObject(self, &AssociatedKeys.indexPath, newValue as NSIndexPath?, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN_NONATOMIC)
}
}
}
}
private struct AssociatedKeys {
static var indexPath:NSIndexPath?
}
var indexPath: NSIndexPath? {
get {
return objc_getAssociatedObject(self, &AssociatedKeys.indexPath) as? NSIndexPath
}
set {
if let newValue = newValue {
objc_setAssociatedObject(self, &AssociatedKeys.indexPath, newValue as NSIndexPath?, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN_NONATOMIC)
}
}
}
}