swift 扩展里面添加属性

var moveAnimationView: UIView? {
get {
if let object: UIView = objc_getAssociatedObject(self, &Macro.moveAnimationViewKey) as AnyObject as? UIView {
return object
}
return nil
}
set {
objc_setAssociatedObject(self, &Macro.moveAnimationViewKey, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
}
}

你可能感兴趣的:(swift 扩展里面添加属性)