0

let me know which one is better ?

@property (strong,nonatomic) id <DelegateProto> delegate ;
@property (weak,nonatomic)   id <DelegateProto> delegate ;

which one is more suitable ? and why ? what are the advantages and disadvantages in both cases ?

Thanks

Regards

Prathap.M

Prathap
  • 399
  • 1
  • 4
  • 13
  • Yes , rmaddy i have watched that question , but i didn't get that much of clarity with those answers , because i don't have that much idea about 'retain cycles' too , could you please explain step by step process what are the problems with 'Strong' (in fresher level to objective C) and why – Prathap Mar 27 '15 at 04:59
  • Nevermind about retain cycles. As long as you're using ARC (automatic reference counting), just follow the rules and you won't need to worry about memory management for the most part. A delegate is a public instance variable (i.e. property) that can be of any type (id) as long as that type has adopted the delegate protocol (inside the angle brackets). A delegate should be WEAK because the delegating class is the child and the child should never have a strong relationship with its parent class. You don't really need to know why to be honest. Just do it... – wildBillMunson Mar 27 '15 at 05:22
  • Avoid Strong Reference Cycles in https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/EncapsulatingData/EncapsulatingData.html – Krishna Mar 27 '15 at 05:38
  • Thanks **WildBillMunsom** and **Krishna** – Prathap Mar 27 '15 at 05:57

0 Answers0