4 ms·
Understanding Automatic Reference Counting in Objective-C
- gdubs 14y agoThere's a good conversation here about dealing with objects inside structs, which is discouraged in ARC: http://www.cocoabuilder.com/archive/cocoa/310392-struct-and-unsafe-unretained.html http://www.cocoabuilder.com/archive/cocoa/310392-struct-and-...
- saurik 14y ago(AFAIK the Objective-C++ compiler doesn't have this limitation, as the struct can be given an implicit copy constructor and a deconstructor.)
- rizwan 14y agoThe page states that ARC is not yet ready, but keep in mind this article was written in Sept 2011. I think ARC is definitely ready nowadays, given the number of libraries and projects using it.
- bennyg 14y agoI was hesitant to try ARC at first - all of the tutorials I saw started with storyboards, which was terrible nonsense, and I wrongly equated that to ARC. I still think about where my pointers are, I'm just writing less code now and I love it. ARC's very, very nice.
- matwood 14y agoThe best part of ARC is the zeroing weak reference. Add those to the ability to send messages to nil and it really cleans up the code. No more if(obj != nil) [obj msg]; all over the place. Very helpful when dealing with delegates. Oh, and I agree storyboards are nonsense :)
- phatbyte 14y agoUnderstanding memory management, and how things work "backstage" is always good but implementing it it's boring and very error-prone. Let's just use ARC, it's ready and it works amazingly well.