Ask HN: Experienced programmer, beginner to iOS (objective-C). Where to begin?
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?
36 comments
[ 2.9 ms ] story [ 93.6 ms ] threadhttp://itunes.apple.com/us/itunes-u/ipad-iphone-application-...
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.
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.
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).
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
Not averse to managing memory :-)
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.
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?
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.
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/...
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.
As a nice bonus, AFNetworking doesn't require you to implement delegates but instead allows you to use blocks, which simplifies things somewhat.
I always like talking about Objective-C and UIKit. Keeps me sharp.
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.
The specific example apps that apple provides that demonstrate one particular thing are great though.
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?
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.
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.
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.
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.
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.
My thought was that switching files to work on resources is bad and the resource info should be in the source code class defintiin.
DoForm() is cool.
ClassRep() is cool.
You know how operator overloading seems awesome to a novice, but only good for Vector or Complex data types, if you are not a retard?
God says... C:\Text\DARWIN.TXT
aves work energetically together with their masters in carrying them away to a place of safety. Hence, it is clear that the slaves feel quite at home. During the months of June and July, on three successive years, I watched for many hours several nests in Surrey and Sussex, and never saw a slave either leave or enter a nest. As, during these months, the slaves are very few in number, I thought that they might behave differently when more numerous; but Mr. Smith informs me that he has watched the
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.
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.