Hacker Newsnew | comments | ask | jobs | submitlogin
Ask HN: Experienced programmer, beginner to iOS (objective-C). Where to begin?
28 points by architgupta 713 days ago | comments
What is the quickest way for an experienced programmer to come up to speed on iOS?

Looking for recommendations on a good book, tutorials. Pointers to good repositories on github also appreciated. I have started reading open-source code from some apps.

I want to write an app which needs custom UI elements (going beyond XCode's available UI elements). An example: a flipboard like app. No game dev.

- I am comfortable in C, C#, Python. I can write Javascript when needed for my web-apps.

- NO experience with Objective-C. Fairly comfortable with ANSI-C.

- I have written web-apps: HTML, CSS, JS as needed.

- I have written desktop apps: So, I am familiar with how to use available UI elements with code behind.

I see clutch.io, RubyMotion, MonoTouch as options too. Any feedback from folks on these?



reidmain 713 days ago | link

I was two years out of school working on C# and WPF when I was tasked with writing an iOS app. My first steps to gain knowledge of the syntax/structure/etc of the language was to watch the Standford CS139p lectures (http://itunes.apple.com/itunes-u/ipad-iphone-application-dev...). I only had to watch the first six or so before I had a good knowledge of the language and the starting point of UIKit. From that point I just started brute forcing it.

Reading Apple's documentation was the fastest way for me to ramp up and they actually include a lot of really useful examples. Even lower level things like CoreGraphics have some in depth examples which will probably be what you need for your "Flipboard" like interactions.

Because I do so much iOS dev I have my own "library" I now use for every project. But it was cobbled together over a couple years and inspiration was taken from many open source projects.

I probably learned the most from Jeff Verkoeyen's GitHub projects, his Nimbus framework being one of the best https://github.com/jverkoey/nimbus

If you need to make web requests in your app (which basically every app should) ASIHTTPRequest is an interesting framework. https://github.com/pokeb/asi-http-request. I took the idea behind this and distilled it down to something that was much simpler which is what I needed. ASIHTTPRequest is sorta the kitchen sink of web request clients.

If you need a relational database in your app, sqlite is a simple include away. There are a lot of wrapper frameworks out there but I didn't use any of them. I wrote my first app directly accessing the C API and then wrote my own wrapper framework for it. Because I had never used SQLite before needed it in iOS it helped me learn a lot more about it.

If you need to store username/password/token/etc for the love of god don't make the novice mistake of saving to NSUserDefaults. Save to the Keychain https://github.com/reidmain/FDKeychain

One thing I'd point you to is my collection of Categories and Macros that I put into every project https://github.com/reidmain/Objective-C-Categories-and-Macro.... Specifically pay attention to FDIsNullOrEmpty, NSObject+PerformBlock, UIView+Layout. I use these categories so much that I always include them in my precompiled header file.

-----

div 713 days ago | link

That's all good advice, but I'd like to point out that ASIHTTPRequest has been abandoned for about a year now. I think most people have switched to using AFNetworking (https://github.com/AFNetworking/AFNetworking) which came out of Gowalla.

As a nice bonus, AFNetworking doesn't require you to implement delegates but instead allows you to use blocks, which simplifies things somewhat.

-----

reidmain 713 days ago | link

The delegates are exactly what I factored out of ASIHTTPRequest when I made my own version. Good to see someone has taken the ball and ran with it.

-----

MPiccinato 711 days ago | link

For anyone else looking for an alternative to ASIHTTPRequest, do check out RestKit (https://github.com/restkit/restkit).

-----

architgupta 713 days ago | link

Thanks a lot for the detailed reply. Much appreciated.

-----

reidmain 713 days ago | link

My pleasure. If you have any other questions about specific frameworks or nuances of UIKit don't hesitate to ask.

I always like talking about Objective-C and UIKit. Keeps me sharp.

-----

speg 713 days ago | link

I am going through the exact same thing. Last weekend I decided iOS would be my project for May and started digging in.

There is a TON of information out there. Too much. Most of it is outdated, and while the Apple documentation is a great resource, it is just not structured in a way for beginners.

Enter the Big Nerd Ranch.

http://www.bignerdranch.com/book/ios_programming_the_big_ner...

I think I got the kindle version for $22. It is perfect. Just released a little over a month ago, it uses Xcode 4.3. The first few chapters have no iOS stuff as they bring you up to speed on Obj-C and from there you start building the bases of iOS.

I love that they make you strip out all the code from the iOS templates and make you do it yourself. It really is a structured learning experience rather than just an information dump.

I'm only about 1/3 the way through so far - but so far it's been exactly what I needed.

-----

architgupta 713 days ago | link

Aah thanks! Looks like many people like Big Nerd Ranch! I am going to spring the $22 then :)

-----

keiferski 713 days ago | link

Stanford's course is often recommended. I just started going through it myself.

http://itunes.apple.com/us/itunes-u/ipad-iphone-application-...

-----

div 713 days ago | link

Stanford's course is excellent. If you're starting out, watch a lecture a day alongside any other reading / researching you do.

The nice thing about the Stanford course is that it covers a lot of ground, ranging from good code design, to all the major Cocoa components, to details about most of the important ios lifecycles.

-----

checker659 713 days ago | link

Read the docs from Apple. Believe or not, they are the best resources for an experienced developer. Start with the Objective-C 2.0 book/entry. Then, go from there.

Of course, if you didn't say you were experienced, I'd have suggested that you start with the (what now must be like a) gazillion different apress/o'reilly books on the topic.

Good luck!

The book: https://developer.apple.com/library/mac/documentation/cocoa/...

-----

officialchicken 713 days ago | link

I'd say there's no quick way to do it, the message passing of obj-c is very different than the event-based slots & signals programming you are used to. And that's before the hell-which-is-InterfaceBuilder. Since you already familiar with programming, I'd suggest the Big Nerd Ranch guides at bignerdranch.com

Most online examples won't give you the details about the important stuff - single inheritance vs. categories, delegates and message passing in the runtime, extending a protocol, etc. You may see it in the code, but there won't be any theory or reasoning behind it to help you.

As a side note, you can track your learning progress by how much you hate XCode with specific examples of how it ruined your day.

Can't speak to clutch.io, but the other 2 just seem to get in the way of someone who already knows Ruby, C#, and obj-c. Do you really need another layer of abstraction if you want to learn something at a lower level?

-----

jamesjn 713 days ago | link

I second the recommendation of the Big Nerd Ranch guides. They are excellent for learning Objective-C and IOS.

I've been playing around with Ruby Motion for the past two days and since I am pretty experienced with Ruby already, I'm finding it helpful for learning ios concepts. However, if you don't have any experience with Ruby I would recommend just starting with Objective-C and xcode.

-----

octopus 713 days ago | link

For your level of experience I would go would go with Kochan - Programming in Objective-C 4th edition.

There is also a free course for iPhone programming from Stanford (video lectures).

MonoTouch is a good alternative if you prefer to use C#, but you will need to pay 99$/year to Apple + 399$ for Monotouch. The good thing is that you can evaluate MonoTouch and pay after you are comfortable with the tool.

RubyMotion is too young to be used in a large application. Also learning Ruby and Cocoa in the same time can be difficult. I think RubyMotion is a good fit for an experienced Ruby programmer that wants to start coding on iOS. Another potential problem with RubyMotion is that it is currently developed by a single person, which can be problematic on long term.

That been said, muy advice is to go on the Objective-C route since you are already comfortable with C. Objective-C is a small language and an experienced C programmer can be up to speed in a matter of days.

The real challenge is in learning the iOS libraries and not the programming language.

-----

architgupta 713 days ago | link

Yes, the general opinion seems to be:

Use Objective-C with the new Automatic Reference counting mechanism.

iOS libraries - in your opinion - what are some good resources to get familiar? (Google-fu results in a lot of links to wade through).

-----

officialchicken 713 days ago | link

I can not agree with recommending ARC to anyone at this time; in this case there is a ton of existing code out there which is incompatible with it. If you are an experienced obj-c developer who's tired of writing boilerplate and uses the static analyzer with LLVM - then go for it.

Learning to clean up after yourself is a life skill worth having. And besides, there's always the -fobjc-arc flag for classes which use it.

EDIT: Every project seems to include: Reachability SBJson ASIHttp

And also commonly occurring: OpenUDID ZipKit NSLogger InAppSettingsKit (there are others) Cocos2d/3d

-----

architgupta 713 days ago | link

Thanks for the heads-up on ARC.

Not averse to managing memory :-)

-----

mikeash 713 days ago | link

If you need to include those files in your project, you can just turn ARC off for them while leaving it on for the rest.

-----

Arcanum-XIII 713 days ago | link

You can disable ARC for some or all part of your program, so lib compatibility is not a problem.

-----

octopus 713 days ago | link

I suggest you to do a search after iOS 5 on Amazon and check the comments before buying a book. I'd stay away from any of the Appress books on Objective-C, iOS, etc ... low quality of information and a lot of typos.

Personally I don't have a preferred source and I tend to use Apple's documentation or tutorials from websites like:

http://www.raywenderlich.com/

iOS is a moving target so it is difficult to find a good book on this.

-----

gdubs 713 days ago | link

Big Nerd Ranch guides are indispensable. Written by someone who was involved with NextStep very early on.

Watch the Wwdc videos, starting at 2010, and following with 2011.

Use ARC.

Pay attention to the Wwdc videos on core animation.

Spend time learning about delegates.

Don't shy away from Interface Builder.

Check the header files when documentation seems incomplete. They are a great resource.

-----

architgupta 713 days ago | link

ARC's usage seems conflicted! :D

-----

gdubs 713 days ago | link

Apple's recommendation is to start using it today. Retain/Release patterns always took newcomers a long time to master, and it distracts from building applications. In Apple's own words, it's a compiler's problem – shouldn't be yours.

-----

codercowboy 712 days ago | link

I was more or less the same as you, Java instead of C#. Built some of the apps on http://www.codercowboy.com in a few weeks with help from this book, very highly recommended:

The iOS 5 Developer's Cookbook by Erica Sadun

http://www.amazon.com/The-iOS-Developers-Cookbook-Programmer...

A few (three or four) zero-to-go chapters in about 50 pages, then entire chapters dedicated on various chunks of the IOS objective-c library. Perfect.

-----

perezda 713 days ago | link

Start with the Stanford course. It's the best free resource out there. Find a local meetup. Go to a couple hackathons.

re: other comments -

Apple's docs aren't great, in fact I hate them. Haven't put my finger on why.

I like some of the controls at http://cocoacontrols.com

I wouldn't start with Arc. Especially since you're comfortable in C.

-----

BenSS 713 days ago | link

The apple docs are pretty comprehensive. I think of it as you're not going to learn English by reading a dictionary.

The specific example apps that apple provides that demonstrate one particular thing are great though.

-----

micro-ram 713 days ago | link

Going down the same road myself. Here is my page of links (http://iosln.com)

-----

0xSina_ 713 days ago | link

Started iOS dev about a year ago. Hvaent written dozens of apps some with very custom UI elements. Don't bother with clutch.io/rubymotion/mono touch. Learn the raw Objective-C/Cocoa-Touch APIs. Especially for something UI intensive like flipboard. Check out Standford iOS programming lectures. They are on Youtube and iTunes (for free).

-----

enobrev 713 days ago | link

I keep getting stopped up at the first step: Buy an Apple Computer. If I can ever build IOS apps on Linux, I may move on to step two.

-----

mkopinsky 713 days ago | link

Can anyone specify the absolute minimum requirements I should be asking for if I'm looking for a dev Mac on craigslist or the like?

As a (mostly) web developer there's a good chance I'd build most of my app in HTML/CSS using something like PhoneGap and only do the final compile step on the Mac. A) Does that sound like a good plan? B) Does that impact significantly on the minimum system requirements?

-----

Wilya 713 days ago | link

I'm not very familiar with how PhoneGap works, and how much it depends on you, but from the docs it seems you still need the classical toolchain.

But anyway, if you want to save yourself some hassle, find something that can run Lion. XCode 4 doesn't run on older OS (or at least not easily), and most current docs are aimed at it (I'm not even sure older XCode versions cover the current iOS versions).

So, you need at least something with a Core2Duo. Older Core Duo might work, I'm not sure. I have some old white Macbook (13" from 2009), who mostly does the job. Not blazing fast, but since I only use it for iOS development, it's enough.

-----

mikeash 713 days ago | link

Make sure you get something that can run the 64-bit kernel, as this will be a requirement for running Mountain Lion when it comes out this summer. You don't want to be stuck on an older OS, as Apple quickly stops supporting them for the latest developer tools. Which models support the 64-bit kernel is not obvious, as it is not the same thing as simply having a 64-bit processor.

A list of Macs that will probably support Mountain Lion is available here:

http://en.wikipedia.org/wiki/OS_X_Mountain_Lion#System_requi...

Beyond that, you want at least 4GB of RAM, with 8GB or even 16GB preferred (Xcode is a severe memory hog), especially if you get a spinning platter instead of an SSD.

I would strongly recommend against something like PhoneGap. iOS users generally don't appreciate non-native interfaces, and it will be extremely hard to achieve the necessary level of polish with HTML/CSS. If you want to use HTML, then you probably might as well just go straight to building a real web app. If you want native apps, it's worth your while to use the native language and tools.

-----

mkopinsky 713 days ago | link

Thanks for the insight re: PhoneGap and native interfaces. Does the same apply to Appcelerator (or similar)? It compiles to native, but does the interface feel native or HTMLy? At some point I want to play around some, but that requires buying a mac and an iThing, neither of which I have yet.

Re: system requirements - that sucks that I really need to have (moderately) up to date hardware to do iOS development. On a PC I'd probably be fine with a 2004 Dell laptop with a fresh install of Windows. I guess this is my first "welcome" to the walled garden.

-----

mikeash 713 days ago | link

Reading up on it, Appcelerator gives you native UIs with non-native languages, so it should be much better in that department. I'd still recommend using the real thing, at least to learn.

Macs have changed a lot since 2004. Buy a Mac of that vintage and it's still a PowerPC, no Intel chip. You can run iOS development tools on such a thing, but they will be seriously old.

-----




Lists | RSS | Bookmarklet | Guidelines | FAQ | DMCA | News News | Feature Requests | Bugs | Y Combinator | Apply | Library

Search: