As the title states, why are UIKit
delegates (assign)
instead of (weak)
?
See UIPopovercontroller.h
for example:
@property (nonatomic, assign) id <UIPopoverControllerDelegate> delegate;
As far as I can tell this provides no benefits over a weakly retained property but a lot of problems where the delegate needs to manage it's own lifetime as a delegate. It this a backwards compatibility issue?
Thanks
Because most of those properties existed before the iOS SDK supported weak properties. The weak
attribute is only supported on iOS 5.0 and later.
I would have to guess that once iOS 4.x and earlier is history, they will all be updated to weak
.
UIKit is still built without ARC, therefore none of the UIKit classes can use weak references. Even newer classes like UICollectionView use assign for their delegate properties for this reason.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With