Live data from Hacker News

iOS Development Tips If You're Just starting Out

stuartkhall.com

21–30 of 105 posts

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

#21
Mostly a really good list. My only nitpick is:

RegexKitLite - Powerful regular expression support

Use NSRegularExpression instead. It's built into the OS (in Foundation) as of iOS 4, which is below the minimum target you have (if you support the iPhone 5).

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

#22
As long as the beginners are drifting by, lemme say this:

Every nib you use is a boatload of code you don't have to maintain. Use nibs. Can they solve every problem? Goodness no. But they're a great way to get the basics of your views laid out. They give you an easy way to preview the behavior of your view when layout changes.

And they're very forgiving when you change your mind. Changing text alignment? One click. Want to change the balance or padding of some elements? Nudge them around with a real time preview until you're happy. Mess with different color combinations in your UI to your heart's contentment.

Doing all your view layout in code gets damn tedious when you have to compile and run each time to check your results.

Every now and then some crackpot will come along and tell you never to use nibs. Ignore them. Use nibs when they make sense for your workflow. End sermon.

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

#23

Otherwise you can just use git submodules. I would recommend against it. They become a real pain down the road. I wish I had something to suggest as a replacement. We're still trying to figure that one out ourselves. We just know we won't use submodules again. For now, we're manually managing disjoint repositories.

The replacement is definitely the article's first suggestion: Cocoapods. Cocoapods is awesome and is rapidly being adopted by major repositories like AFNetworking, Kiwi, TTTAttributedLabel, MagicalRecord, and more: http://www.cocoacontrols.com/cocoapods

It has been super easy compared to git submodules.

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

#24

Thanks - as it happens I'm about 3 months in to learning Objective-c and iOS development. This is super helpful, as many of the tutorials online are dated. Right now I'm working through the Ray Wenderlich stuff which is really good, at least as far as I can tell. w/r/t using the visual XIB/Storyboard interface vs. coding the views, I've found early on that while the nibs and storyboards make it easy to prototype and…

Eh, I wouldn't be so sure. I remember from the WWDC 2012 presentation that the iPhoto team talks about how they used xibs in their workflow, and iPhoto is an extremely impressive app. There's also the fact that you can do alot of setup with a xib or storyboard, and then do relational layout programmatically.

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

#25
post #20

Earlier quoted context omitted.

Agreed. If iOS actually had a sane declarative language like Android's xml layouts then I'd do everything in code but since layouts coded in Obj-C are excruciatingly painful to read and edit you're better off with a WYSIWYG tool, even if (IMO) WYSIWYG is fundamentally the wrong approach for UI development. I actually consider this a big liability for Apple going forward. The explosion of "phablets" and other form fac…

Cocoa Auto Layouts are what you're looking for: https://developer.apple.com/library/mac/#documentation/UserE...

They're better than nothing but compared to the html-esque layouts in Android they're much harder to write, read and debug.

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

#26
post #14

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 w…

Have you tried JetBrains's AppCode? http://www.jetbrains.com/objc/ (I haven't but their RoR-tailored IDE RubyMine is the only IDE I've enjoyed using after it for less than a week.)

AppCode is brilliant. Best $99 I ever spent on a development tool. It's worth it for the refactoring and #import management alone.

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

#27

Earlier quoted context omitted.

100% agree. IB makes for faster development time, easier maintenance, and it's way better for auto layout if you're targeting iOS 6.0

I think there's a case to be made though, that using IB when starting out doesn't make you fully understand how UIViews work. So starting out I'd probably recommend you make your own views programmatically to know what you're hooking into. That said once you get that base level of understanding, nibs and storyboards are huge time savers, and are the way to go.

While using storyboards definitely meant that I didn't understand things like how my root view controller got set up, I don't think it abstracts too much. Most importantly, using Interface Builder allowed me to explore the properties of views and get immediate feedback on how they're made. I still go back to a Storyboard when I need to figure out what combination of UIControl content settings I need.

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

#29
post #18

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 w…

I am totally satisfied with Uncrustify, and this is my Uncrustify's config for Objective C, in case you find it useful (Allman style): https://gist.github.com/940977

It took me about an hour to get uncrustify to actually work. Without a config file it makes no changes which is silly. I wanted it to modify the files inplace, and kept finding it creating numerous extra files but not actually making changes. Or sometimes it did but not again. I prefer my tools to be trustworthy, just work and not require babysitting.

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

#30

Otherwise you can just use git submodules. I would recommend against it. They become a real pain down the road. I wish I had something to suggest as a replacement. We're still trying to figure that one out ourselves. We just know we won't use submodules again. For now, we're manually managing disjoint repositories.

The replacement is definitely the article's first suggestion: Cocoapods. Cocoapods is awesome and is rapidly being adopted by major repositories like AFNetworking, Kiwi, TTTAttributedLabel, MagicalRecord, and more: http://www.cocoacontrols.com/cocoapods It has been super easy compared to git submodules.

Do you have a non-Apple-specific suggestion? We do cross platform development, so Cocoapods aren't an option.
Post reply on HN