On 3 Jul 2011, at 12:49 PM, Phil Hystad wrote: > I just started playing around with iOS 4 and Xcode 4. Learning the ropes of > the new Xcode I see a difference in how the project templates are used to > create a simple Cocoa window app in iOS versus Mac OS X. > > With iOS, the app delegate handler code .h file does not declare the window > pointer variable which I see is prefixed with an underscore as in _window. > > With Mac OS X, the app delegate handler .ht file does indeed create an > instance variable for window and it does not have the prepended underscore. > > Can someone describe why this was done (differently) if there is a purpose to > this? Where is the _window instance variable created?
Right now, I don't have access to the tool set you're probably using, but I believe the iOS template relies on the ability of the @synthesize directive of the modern Objective-C runtime to create backing variables for @property declarations. (Am I right that the header you're looking at includes a window @property?) iOS is guaranteed to be running the modern runtime, whereas 32-bit Mac OS X does not. As for a leading underscore, it's a matter of coding style, on which Apple never really settled (unless they're settling now). I see the merit of putting a special mark on instance variables, but I admit I haven't done it since I last used PowerPlant. Your question implies that you expect more parallels between AppKit and UIKit than would be helpful to you. — F _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com