associated-object

How to have stored properties in Swift, the same way I had on Objective-C?

青春壹個敷衍的年華 提交于 2019-11-26 00:46:43
问题 I am switching an application from Objective-C to Swift, which I have a couple of categories with stored properties, for example: @interface UIView (MyCategory) - (void)alignToView:(UIView *)view alignment:(UIViewRelativeAlignment)alignment; - (UIView *)clone; @property (strong) PFObject *xo; @property (nonatomic) BOOL isAnimating; @end As Swift extensions don\'t accept stored properties like these, I don\'t know how to maintain the same structure as the Objc code. Stored properties are