Live data from Hacker News

iOS Development Tips If You're Just starting Out

stuartkhall.com

31–40 of 105 posts

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

#31
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.)

I haven't but I did look at the page as it was linked in the article. I never saw any mention of code formatting. An example of what I expect is like the Eclipse Source > Format option which will go in and make everything consistent including making lines less than 80 chars, adding space around operators (I never put in spaces which goes against almost every style guide), ensuring the arms of if/else always have braces etc.

I actually do most of my iOS development by running emacs on my Linux box and using sshfs to access the files on the Mac. I use command line tools for compilation/running/debug. I did originally start out using Xcode but it gets in the way of the coding. (My work involves a library that functions in the background and has no user interface.)

AppCode hasn't seemed worth the effort to investigate and $200 is rather a lot to spend on a code reformatter. (Also only running on MacOS makes it significantly less useful to me.)

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

#32
post #18

Earlier quoted context omitted.

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.

You can use the Xcode "Run Script" build phases to automate the code format if you really need it (with Uncrustify's --no-backup option).

I agree Xcode should have this feature by default, but speaking for Uncrustify - it is reliable and always produce consistent output format. Anyway, it also took me more than an hour to configure it :)

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

#33
post #14

Earlier quoted context omitted.

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.

> It's worth it for the refactoring and #import management alone.

That is something Eclipse does out of the box! Apple really disappointed me with Xcode - it is actually less usable than Eclipse in my experience. This is not praise of Eclipse - it has many issues!

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

#34
post #4

Earlier quoted context omitted.

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

My experience is all pre-autolayout, which is very new. It sounds like I definitely need to take another look for future work.

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

#35

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.

what problems did you experience with git submodules?

You can't push your modifications to a submodule you don't own.

Also, you can only remove a submodule manually. There's no option to have git do it for you.

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

#36
post #32

Earlier quoted context omitted.

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.

You can use the Xcode "Run Script" build phases to automate the code format if you really need it (with Uncrustify's --no-backup option). I agree Xcode should have this feature by default, but speaking for Uncrustify - it is reliable and always produce consistent output format. Anyway, it also took me more than an hour to configure it :)

Actually running uncrustify isn't a problem - I intended to make a shell script. What I wanted to do and have just work (HN won't let me use a literal asterisk so I used STAR):

uncrustify --inplace STAR.h STAR.m

I ended up having to download configs, deal with differences between the versions of uncrustify and configs, work out how to do inplace, get confused when it did it sometimes and not others, go "holy cow" when git showed all these extra files appearing (uncrustify does some sort of hashing scheme to avoid processing files seen before), trying to work out which files I could get rid of, finding it had put reformatted output in files with different extensions, trying to figure out what had happened, finding out that it doesn't autodetect headers as objc etc. And suspecting it may have problems if directories/files have spaces in their names.

I know it can work. I just don't trust that it will always work.

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

#37

Earlier quoted context omitted.

what problems did you experience with git submodules?

You can't push your modifications to a submodule you don't own. Also, you can only remove a submodule manually. There's no option to have git do it for you.

Regarding pushing modifications: Why not fork the submodule to your own remote? That's what we do.

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

#38

Earlier quoted context omitted.

what problems did you experience with git submodules?

You can't push your modifications to a submodule you don't own. Also, you can only remove a submodule manually. There's no option to have git do it for you.

The first thing you should do is fork the repository and set up a remote for pulling in upstream changes.

There are a lot of useful libraries out there, but I find I occasionally need to make changes. Sometimes there are bugs; sometimes the maintainer has lost interest. I need to be able to pick up the slack when that happens.

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

#39

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!

As someone with experience in several RAD tools, I never understood the design UI in code mentality.

Sure, you can control all your code, but there is so much time that is lost until the UI is finally ready, and than the marketing department wants it redone in one day.

Post reply on HN