Monday, January 07, 2013

A Little iOS

I have been curious about pure iOS development for a while now.  While I have run plenty of game experiments on my iPhone, they have all been Unity projects. Unity takes care of the nitty gritty details of generating a "proper" project that you can build in XCode (Apple's one and only software development suite) and deploy on the devices.  But now I finally had the chance to create a true native application using Apple's own Objective-C language and directly using the iOS frameworks. That checkbox can be checked. Done! Phew...

This is the book that helped me: Programming iOS 5: Fundamentals of iPhone, iPad, and iPod touch Development.  I can't say I would recommend it unless you are already good at programming. It worked for me, but it's quite hefty.  It's almost a thousand pages long! Luckily I did not have the read the whole thing for the simple app I had in mind.  The rest will have to wait until I need to make something more interesting.

My simple app doesn't do much, but it is something that I have been wanting ever since I got a modern phone.  You see, time is precious for me.  I have too many responsibilities fighting with my interests for that golden resource. Shaving a few extra minutes from my early morning routine would really help.  My app is basically a timer that tells how much time has passed using beeps.  A low beep for each group of five minutes, a high beep for each extra minute (so at the 12th minute, it would emit two low beeps and 2 high).  That way I know how much time I've spent getting ready in the bathroom without looking at the phone. And hopefully get gently awakened if I dose off: it happens.  This is what it looks like:

The trickiest part was to make it work even when the screen locks or the app moves to the background. Apple goes through great pains to avoid having background applications hog your phone, so a few non-obvious tricks were needed.  Thank you Google for giving me the key to those!  The code, if you are interested, lives in my BeepTimer Github page.  

No comments:

Post a Comment