My First iPhone Application
Wednesday, April 29th, 2009After watching the videos that Apple have provided on their developer site, building an iPhone App suddenly started looking very daunting. Lots of new jargon and accronyms that I didn’t understand, nor cared to learn, so I hunted around for some bedtime reading.
A friend of mine sent over a few PDF’s, one of which was a step-by-step example of how to create an app, so I delved into those and started to get to grips with those. One of the biggest recommendations I’d make to anyone when they start out is simply not to bother listening to the smug whinings of the “experts” over at apple and find the simplest possible example tutorial.
Now I won’t pretend it was easy, and for those of you who’ve never coded anything before, I can imagine it would take a while to get into it. My background is PHP mainly, and orginally I used to code up shell scripts for people and a bit of PSL (I’d be surprised if many people had heard of that: Patrol Scripting Language?) which was procedural, so the programming techniques used in XCode are pretty new and intimidating at first.
To begin with there are a lot of files and folders which are initially confusing and frankly irrelevant. The main folder to concern yourself with after opening XCode up is the “Classes” folder. But I’m getting ahead of myself, the first instruction was to create a new project by clicking on “File” -> “New Project”.
Right, so I need to open XCode…
Where’s that? Quick internet search… Ah, I see, click on the Macintosh HD, then the “Developer” folder, then “Applications”.
What we need to remember here is that I’ve not actually had a good play around with my new Mac and I’m totally green. Nothing seems to be in a logical place! Right, now I need to click on File.
Right, where’s the menu bar…
Anyone?
Ah, okay, it’s not at the top of the “Welcome to Xcode 3.1″ window. Click on a few links, nope, they’re just web pages.
Now I’m not normally a very thick person, but it did take me some time to realise that it was at the top of the screen next to the apple symbol. Looking at it now, that does make a great deal of sense, but any *nix/Windows person may well get as stumped as me!
So now I’ve got my Xcode “cocoa” project open, and I’ve right clicked on the “Classes” folder (now I have a two button mouse plugged in from the loft! Why build a mouse with one button? Real mice have two ears after all). This is where it started to get easier.
The IDE provided is really user friendly if you’re trying to build a basic application. The programming syntax is a little hap hazzard at the moment, but I’m sure it’s all for a good reason. The “classname.h” and the “classname.m” seem to replicate code, but I’m guessing one is a handler and one is a model, something along those lines.
After a just a small amount of playing I developed myself a sliding number application with a reset button, a bit more satisfying than “Hello World”.
All in all, not quite as hard as I’d imagined, it just takes some time to get round the nuances of OS X. At first everything seems to be overly awkward, but the more I use it, the more it seems to make sense!
