Programming Posts

A Standard set of CocoaPods for a new iOS project

A Standard set of CocoaPods for a new iOS project

One of the side effects of freelancing is that I get a lot of opportunities to write apps from scratch, and as a consequence I notice a lot of patterns when creating new apps.  Most noticeably is that iOS apps in general are pretty similar in their base structure.  E.g. you’ll almost always need a networking layer, some sort of persistent layer to store data, etc

After learning to code in Ruby on Rails last year I’ve become a total convert to CocoaPods (the iOS equivalent to RubyGems), and have found that using pods is the quickest way to make that base structure when creating a new iOS app.

If you’re a freelancer like me, or someone who wants to make an iOS app and are looking for some good foundation libraries to use, I’ve written my collated list of pods below.

 

MagicalRecord

awesome_logo_smallI know some people hate it, but I found this is one of the quickest way to get an app running with core data, and also provide a very nice set of wrappers around it (which I’ve found you’d usually have to write some variant of anyways).

 

AFNetworking

The best networking stack on iOS.  There’s really nothing much else to say.

 

CocoaLumberjack

LumberjackLogoA very handy library for logging output to different locations (e.g. to the console, or to a file, etc), and which you can change based on which environment you’re running in, and what type of log output it is.

 

UIAlertView+Blocks

How often do you write a UIAlertView and just want to use a block to handle the callback for when a button is tapped?

To be honest, I actually prefer UIAlertView-Blocks (note the minus instead of a plus) though the Podspec for UIAlertView-Blocks is a few versions behind the github version and misses some functionality which is available in UIAlertView+Blocks.

 

SVProgressHUD

A library to show an activity indicator which covers the entire view (I still find it strange that this doesn’t come out of the box).

 

UIViewPlusPosition

Actually part of the Moriarty collection of useful iOS classes (though I only use the one class), which allows you to move / resize UIVIews as easily as below:

view.frameY +=5;  // Move a view down 5 pixels
view.frameWidth += 100;  // Increases the view's width by 100 pixels
view.frameBottom = parent.frameBottom - 5;  // Align the view's bottom to the parent view's bottom

 

Masonry

Just like UIViewPlusPosition, except for auto-layout.

 

Reveal-iOS-SDK

icon-largeThe iOS version of FireBug’s DOM inspector.  Not exactly a “pod”, but  I can’t count the number of times I’ve had to lay out a view only to  find it missing when running the app, and then loading up Reveal to see it has been positioned somewhere I would have never found.  Unfortunately it’s paid software, though Shaun is a nice enough guy and deserves a few dollars his way ;)

If you’d like a free solution you can give DCIntrospect-ARC a go (DCIntrospect looks like it’s no longer maintained) though be warned, I’ve found that because it hooks straight into the view hierarchy it sometimes causes weird behaviour in your app.

 

SVWebViewController

I don’t know why but nearly every app that I’ve written requires a UIWebView controller, and this is the best “out of the box” solution I’ve found.

 

And I think that should be it.  If you think there’s anything I missed, or you’d like to make a correctly leave me a note in the comments below :)