Re: NSApplicationMain question
Re: NSApplicationMain question
- Subject: Re: NSApplicationMain question
- From: Graham Cox <email@hidden>
- Date: Fri, 23 Apr 2010 11:15:33 +1000
On 23/04/2010, at 8:45 AM, Bill Appleton wrote:
> so like step one is to replace WindowRef with NSWindow and watch the carnage
> ensue
Which it certainly will, so why bother wasting your time?
I came from a Carbon (in fact classic toolbox before that) background and have been doing Cocoa now for 6-7 years. Unless you are fairly familiar with a Carbon-based framework such as Powerplant, TCL or MacApp, it's unlikely that Cocoa will look very familiar.
If you are porting an app where the majority of the functional code is GUI and platform independent then you'll probably be better off casting off all Carbon GUI code and building a Cocoa GUI from the ground up. This is much easier than it seems, especially given how much work you had to do in Carbon to get a functional GUI of any complexity working. All basic event handling, window selecting, menu and control handling and mouse input are pretty much handled for you. That's a big chunk of what most Carbon apps do taken away from you right there (though Carbon definitely does more than the original toolbox, which didn't even implement the main event loop for you).
Read books. Hillegasse is frequently recommended, but there have been a number of more recent books released. Cocoa sticks pretty well to well-established design patterns, so the classic 'Design Patterns' (Gamma/Helm/Johnson/Vlissides) should have a place on your shelf.
Build a small exploration app in Cocoa to familiarise yourself with how to program in Cocoa. A little time spent doing that without trying to port your existing code straight off will pay off greatly when you come to tackle the real thing. There's also plenty of sample code out there which show how real apps are put together. Trying to port a Carbon app at the event handler level is likely to be frustrating and will fail. On the bright side, chances are that when you're done your app will be significantly smaller and much less encumbered by structural baggage that contributes nothing to what makes your app worth having.
--Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden