At Lateral View, we all get along, we hang out and help each other whenever we can, we work as a real team! But let’s face it, there are some topics that can’t be discussed on the dinner table: Argentinean soccer, religion, and -the eternal rivalry- iOS vs. Android. Everyone has their own personal preference about it!

A few weeks ago, one of our awesome Android developers, Martin, shared a post on ‘Good practices to become a great Android developer’ and the iOS team didn’t want to stay behind. This post is dedicated to all iOS developers out there wanting to become great!

What it takes to become great? That’s what we will try to answer here today. To be great is an utopic level of knowledge and understanding someone never actually reaches, but you can always be a step closer to it. Here in Lateral View we work very hard in order to improve ourselves everyday because that’s our goal, to be great at what we do. In this post we have gather some good practices and tips we have learnt during this ongoing process of improvement.

In case you are new in the iOS development world, this post is the perfect complement to one of the tons of guides and tutorials out there. If you are still looking for a good beginners guide, check out the Stanford University courses for iOS on iTunes U.

1. Don’t you dare to use a single Storyboard file for your entire app.

This is a storyboard from hell.

Look at this storyboard. Seriously, this has no sense at all. Here are a few reasons why you shouldn’t do this. A crowded storyboard is unmaintainable. It’s slow, you require a lot of time and process power to load and edit it. Also, if you work in a team, and more that one developer has to make changes in the same storyboard, merging will be very painful.

The best thing to do is to create one storyboard file for each flow in your app. This is really helpful because it keeps storyboards small and clean. Also, grouping screens by flow helps to avoid merging problems and it’s easier to reuse them. This is very easy to do, specially since Apple introduced Storyboard References in iOS 8, which allows to create segues to different storyboards.

2. Auto Layout has come to stay, embrace it.

Auto Layout has been around for a while now, it was introduced in iOS 7, so I think you are already familiar with it, but if not… this is your last call! Auto Layout dynamically calculates the size and position of all the views in your view hierarchy, based on constraints placed on those views. Back in the days when we only had the 3.5-inch iPhone we didn’t have any problems to arrange the elements in the correct positions and size, but since the new 4-inch, 4.7-inch and 5.5-inch screens where released, Auto Layout is a very useful tool that can help us save a lot of time and make your apps look better. Here is Apple’s official documentation about it.

3. Be careful adding new views programatically!

When you create a view programatically and use the addSubview(_:) method to add it to the view hierarchy you are probably missing something… the constraints! Auto Layout is based on the constraints and the rules we set to each view, if you don’t add them programatically you probably will see that everything looks good in your iPhone 5, but test it out in a 6 o 6 Plus, I bet you will have problems.

4. Swift, the not-so-new boy in town.

Swift’s first appearance was in June 2014. It is 2 years-old now and is growing up fast! Each new version brought a lot of new features and improvements, and Swift 3 is no exception to the rule. But I personally think that this language is becoming more mature with each iteration, and eventually, massive changes that could break your entire project will be less and less. Also Objective-C is dead, so get over it and code in Swift.

5. CocoaPods, a world you have to dive into.

CocoaPods is a dependency manager for iOS projects. Here you will find lots of third party libraries you can easily export to your project, customize them and make your app awesome, while you save some time!

If you don’t know where to start, please check out this quick guide on how to add CocoaPods to your project. Always set the dependency version you want to install in your Podfile:

pod 'Alamofire', '~> 3.4'

This is important because if you leave it blank and install other dependencies later, this will update your old dependencies to the newest version available, and you may have to fix your project in order to keep everything working as expected.

Should you commit your Pods directory to your repository or just your Podfile forcing every developer to run a pod install before start working? Everyone has an opinion about this, but we think that including your Pods directory to source control is the easier and most practical thing to do.

6. Vector graphics has traveled from the future to make our assets catalogs simplier.

Xcode 6 allows you to include vector images in PDF format in your .xcasset catalog. When you build your project, Xcode will create the famous @1x, @2x, and @3x PNG files from the PDF, and iOS will use only the needed images.

7. IBInspectable and IBDesignable will literally let you see magic in your Interface Builder.

Let’s say a designer asks you for a button with border and rounded corders. You can do this programmatically:

button.layer.cornerRadius = 5

button.layer.borderWidth = 1

button.layer.borderColor = UIColor.blackColor().CGColor

button.layer.maskToBounds = true

Or set the User Defined Runtime Attributes:

What if I tell you… You can have something like this:

Do you realize what has just happened? You have configurable attributes right in your Interface Builder and what’s more, you can see your changes live in the storyboard without running your app.

How to do this? Simply create a subclass from UIButton with the following code (You can also create a UIButton class extension to make this functionality available in every button of your project).

If you want to learn more about this, we recommend you read this post.

8. Include Unit testing!

Testing is something that can be very hard to incorporate in your project, specially if you take on a project that’s already started, but it’s not impossible and it will help you a lot. We have some recomendations for you about testing, check this out!

Do you know other good practices and tips your own? Share them with the world in the comment section below!

Read our article about Apple TV to learn more cool stuff about iOS!