Live data from Hacker News

iOS Development Tips If You're Just starting Out

stuartkhall.com

1–10 of 105 posts

Re: iOS Development Tips If You're Just starting Out

#3

Utilizing storyboards and xibs is one of the best way to decrease development time. Stop the coding madness!!!! The only people I still know that avoid heavy utilization of these do not understand how to properly use them. Go learn!

Totally agree. It's well worth working closely with your designer to make your interface work with nibs, not against them. Little things like putting button icons on the left side of the button and putting a 20px gutter between elements add up fast.

Re: iOS Development Tips If You're Just starting Out

#4

Utilizing storyboards and xibs is one of the best way to decrease development time. Stop the coding madness!!!! The only people I still know that avoid heavy utilization of these do not understand how to properly use them. Go learn!

I started out using XIBs, but also found myself moving a lot of my controllers away from them as soon as things got non-trivial. The biggest problem I found was weak layout support, so if you had a lot of dynamic content in a screen, it was easier to make a flexible layout in code.

I also agree that the lack of "diffability" for XIBs, despite them being XML, is a pain.

Maybe I was missing something, but my experience matches the OP.

Re: iOS Development Tips If You're Just starting Out

#5
Pretty good tips. Re: being aware of retain cycles -- this is not just for blocks but really in general. When you start out you should immediately learn the conventions and adhere to them strictly. (Unfortunately the APIs don't always, I'm looking at you NSURLConnection!)

Another tip: try both Xcode and AppCode: http://www.jetbrains.com/objc/. It's a subjective thing but for myself AppCode is far better (it helps that I also use IDEA for Java, including Android).

Re: iOS Development Tips If You're Just starting Out

#6
post #4

Utilizing storyboards and xibs is one of the best way to decrease development time. Stop the coding madness!!!! The only people I still know that avoid heavy utilization of these do not understand how to properly use them. Go learn!

I started out using XIBs, but also found myself moving a lot of my controllers away from them as soon as things got non-trivial. The biggest problem I found was weak layout support, so if you had a lot of dynamic content in a screen, it was easier to make a flexible layout in code. I also agree that the lack of "diffability" for XIBs, despite them being XML, is a pain. Maybe I was missing something, but my experience…

Perhaps you're missing something. XIBs are arguably among the most powerful features of Cocoa. I built an app with a really complex, dynamic layout using them (look up "Panna" in the App Store). Working with an evolving design and changing team, with layout elements often changing and getting tweaked in tiny ways... Well, if I did the entire layout in code, I would have needed a full-time developer just for the ongoing GUI changes. I agree that dynamic layout support was weak pre-constraints, but it was still a much better development experience, and now you can do really complicated things without any code at all.

If you're just talking about some buttons in a toolbar, go nuts, but otherwise it's worth the time investment to learn.

Re: iOS Development Tips If You're Just starting Out

#7
The thing I have missed the most with Objective C is the lack of a code tidy/formatting tool. All Xcode can do is alter the indent on each line which isn't useful. Regular indent etc do not support the language. There is an uncrustify tool in various SO answers but it is a good example of how not to do things (eg by default it does nothing - there are no presets, it is very flaky).

I wish Google provided tidy tools with their style guides, or Apple did something with Xcode.

Re: iOS Development Tips If You're Just starting Out

#8
CocoaPods (http://cocoapods.org/) is a really easy way to integrate 3rd party libraries into your iOS and OSX projects. It follows a similar pattern to bundler for ruby; you just specify a library by name and a version number in your Podfile and CocoaPods handles the rest. Another suggestion is to use categories on Cocoa classes for operations you do often. It cuts down on code duplication and makes your code more readable. One I use in every single project is a category on UIView allowing me to do such things as 'myView.x = 5.f' instead of pulling out the views frame, updating the frame and then setting the frame again. I also agree with the other commenters that IB should be utilized when possible. It makes iterating on UIs much faster, easier and less error prone. +1 for using blocks though, how did we ever get by before?

Re: iOS Development Tips If You're Just starting Out

#10
Good article, I like these because there are a lot of things I wish I knew when I started iOS development as well 'back in the day' :) Couple nits:

-XIBs are awesome and you should strive to use them, falling back to layout in code when the XIB fails to meet your requirements. Though I'm also finding storyboards hard to swallow for complex projects. -Blocks and GCD are great tools but with great power comes a lot of complexity and consideration, they could easily get beginners in trouble. I ain't saying don't use em, but There Be Dragons Here.

Bravo on bringing up Singletons, thats something I only recently discovered and wish I had sooner. Also, I feel like a primer on delegates, protocols, notifications and selectors: when to use what and why, would also go a long way in the beginning.

Post reply on HN