Since I've just finished writing an iPhone app for the Teesside basketball league I thought it would be a good time to write about some of my experiences of iPhone development.
Update April 2015 - Unfortunately the Teesside basketball league is no more so I have shut down the website and removed the app from the App Store.
Update April 2015 - Unfortunately the Teesside basketball league is no more so I have shut down the website and removed the app from the App Store.
A lot to learn
Professionally I'm a .NET developer, so my main language is C# and the IDE I use the most is Visual Studio. Obviously this is on a Windows machine. So from the outset I had a lot to learn. How to use a Mac for starters, then on to Xcode, Objective-C and the iPhone frameworks. It was more than a little bit daunting.
Xcode
I've spent a significant amount of time using other very good IDEs such as Eclipse and Visual Studio so Xcode had a lot to live up to. I felt it held up pretty well. Code completion, code analysis, version control integration, iPhone/iPad simulator, all good stuff. Refreshingly it's also very quick. Admittedly the project I'm typically loading isn't very big but Xcode typically loads in a matter of seconds rather than the minutes I wait for Visual Studio to start.
When downloading Xcode you don't just get the IDE, it's a suite of tools. Interface builder used to be a separate application but as of version 4 it's integrated into Xcode. I like it. It's not quite as simple as dragging and dropping UI elements on to a view as I'd hoped but it's arguably easier than having to understand HTML and CSS. Out of the box you also get various 'instruments' to help analyse your application. The leaks instrument is the only one I've used so far, and it's very useful. Having something like this out of the box for a .NET web application would be great.
It's not all good though. Perhaps I'm a little spoilt by Resharper but the refactoring and code generation features in Xcode are a little lacking. It's hardly a showstopper though. Another negative is that it's quite error prone. I've experienced numerous crashes. So much so I've got into the habit of using the save all shortcut every minute or so. The handling of folders frustrated me a little as well. I like my projects organised in a nice clean folder structure where every file has it's place. As far as I can tell there's no way to create folders within Xcode. You can only create 'groups' which look like folders but only exist within the IDE. The only solution that I could find was to create folders manually and drag them into Xcode.
Objective-C
Sweet Jesus, its a sea of square brackets! That was my first thought when seeing some Objective-C, which is entirely justified because there are more square brackets that you can shake a stick at. It's fair to say that I found the language quite difficult to get into. There's the aforementioned square brackets confusing my brain, pointers, memory management, strange method names and header files. But, you know what, after a bit of practice it's really not that difficult. The square brackets are used to call methods, or rather send messages, to a class. My fear of pointers was entirely unjustified because in Objective-C is a non issue (in my experience so far anyway). All you need to remember is that object types must be declared as pointers. That's it, there's no pointers to pointers or dereferencing. As of iOS 5 with the introduction of ARC the memory management isn't particularly tricky either. How about the strange method names? Well, they actually make quite a lot of sense when you think about it. So all in all, aside from some syntactical strangeness it's not a bad language to work with.
Was it worth the time?
Someone asked my recently why I was developing a native app rather than a HTML 5 app. Good question. I'm not convinced it's a particularly good reason but web development is my job and I'm pretty sick of trying to create web sites that work in multiple browsers. So the idea of writing a mobile web app that will function reasonably on approximately a gazillion devices, in my own time, makes me feel a little sick. All I want to do is write some code. Partly to try out new techniques and ideas. Partly to learn something new. And partly because I believe building an application, particularly on an unfamiliar platform, is a great way to learn. For this reasons writing a native app was a no brainer for me.
Resources
To learn Xcode and iPhone development I highly recommend Paul Hegarty's Stanford lectures. They really were incredibly useful. In terms of books, I can't recommend any in particular. I bought a couple, one on Objective-C and one on iPhone development. But, due to a combination of a huge amount of free online documentation and the books only covering a small subset of what can be done on the iPhone, I've hardly used either.
Other than the Stanford lectures a few other resources I found useful were:
- http://www.raywenderlich.com/ - Has some great tutorials
- iPhone iOS5 Development Essentials - A free online book
- SVProgressHUD - A loading HUD which looks nice and is ridiculously easy to use
- EGOTableViewPullRefresh - A great implementation of the pull down to refresh control you see in so many apps
- Sudzc - I can't recommended this enough. Not only does it create working code web service from a WSDL, it also creates HTML documentation and demo code in an Xcode project
- The Objective-C programming language - Some useful Apple documentation
No comments:
Post a Comment