A few weeks ago, a Freetrade customer reported that the Android app was being slow.

I was on-call at the time and decided to have a dive into the performance of the app to make sure nothing unusual was going on. 👀

Performance profiling is a tricky subject at the best of times, so I figured an example workflow and process might be useful to those who want to improve the performance of their own apps.

Firebase Performance

The first step I took was to look at the Firebase Performance dashboard — we’re using this in the app to measure performance in…


I’ve struggled a lot with stress levels over the last few years. It seems like other people are in a similar situation, so I felt like being open about how I try to reduce my stress would be a Good Thing To Do. And writing is quite a de-stressing experience any way!

A quick disclaimer — I’m not sure whether these things have actually helped, and I’m quite bad at sticking to them. But, perhaps they help you instead, or get you thinking about how to reduce your stress.

Reduce phone distraction

Smartphones are, for me personally, a pretty awful invention. If the…


Checking in your Pods folder is useful to get developers quickly onboarded to the project, and have builds that are consistently reproducible. However, it makes merge conflicts where two people update pods on separate branches a pain. Here's the technique I've been using for a while, and some background about how Cocoapods works.

Recognising the merge conflict of pods

Typically, when you get a merge conflict in pods, you will see conflicts in these files:

  • Podfile.lock
  • Pods/Manifest.lock
  • Pods/Pods.xcodeproj

If these three files are showing as conflicted, you can use the steps below. …


Unit testing is great, isn’t it? Not only can it help you improve your code, but it can ensure that you don’t mess anything up the next time you come to change it. The downside with testing is that it is very easy to write a test that ends up being a nightmare to read! Here, I’ll go over some useful tips which may make it easier to read and reckon with your unit test code.

Assertions and their use

If you’ve not written a test before, then you may not have seen a typical test assertion. Assertions (like many things in software development!)…


How to prevent tab bars and navigation bars getting in your way.

Recently, like many of you, we’ve been tackling some compatibility issues with the iPhone X. A lot of these boiled down to not using the APIs Apple gave us a few years ago, in order to make this easier, and not everyone was familiar with these, or how to use them.

So here’s a really quick guide!

Layout guides keep views from going underneath bars

View Controllers have two layout guides — the topLayoutGuide and the bottomLayoutGuide (yes, these were deprecated in iOS 11. You can read more about that nearer the bottom of this post).

They’re very useful — in the case your view controller is in…


Whilst looking innocuous, booleans are often a source of code complexity and can frequently be a code smell. Why is this, and what can you do about it?

A boolean (or Bool, or whatever syntax your language uses) is simple construct but can often make code more complex and less straightforward. Whilst there are simply two values of a boolean, true or false*, the fact they introduce a branch into your code is not something to be blindly accepted, but instead challenged.

We use methods like this a lot as iOS developers, as UIKit has many methods like this:

viewController.present(otherViewController, animated: true)

which could just as easily been two methods:

viewController.immediatelyPresent(otherViewController)
viewController.animatePresentation(of: otherViewController)

It is easy for these to get into how we write code, but they’re not…


It’s all too easy to pass information around in your code as strings or ints, but this can soon catch up with you. Swift has a powerful set of protocols to avoid this situation, which can ensure your code is still well-modelled, whilst being easy to write.

Ensuring your code represents the problem being solved is called domain modelling and is an important part of software craft. This means you should create classes (or structs!) that represent the problem, as opposed to using structures like dictionaries or tuples to store your information. …


This article uses Cocoapods as an example, but the idea applies to any dependency system on any platform.

Third-party libraries are just great. By simply adding a line to your Podfile, you can bask in the glow of someone else’s hard work making your app that little bit more fantastic. But how can you improve as a developer this way? And what risks do you expose your app to?

Take a look at most large projects and their Podfile will be big. Third-party dependencies are now a common sight in apps, because they make development so much easier. Need a…


Swift as a programming language focuses on making APIs descriptive and determinate. Completion blocks are less than perfect — but what is wrong with them, and how can we improve their usage?

Cross-posted from the Novoda blog.

The completion block is a very familiar pattern in both Objective-C and Swift. It is a useful feature that allows us to handle asynchronous actions whilst keeping the method call and the resultant code close together. Completion blocks are found all over iOS code, such as this example taken from URLSession :

let task = URLSession.shared.dataTask(with: aUrl, completionHandler: { (data, response, error) in…


I don’t think Swift guard statements are very useful in trying to write domain-driven code. They force you to talk about validation in terms of “is this thing optional or not”, and in some cases, the validation is a) more complex and b) means something more to the developer. For example, these two snippets have the same meaning, but the guard describes less clearly the actual condition — that the array is empty:

guard let item = array.first else {
return nil
}
item.doSomething()

Compared to:

if array.isEmpty {
return nil
}
array.first!.doSomething()

The intention of the code is clearer…

Alex Curran

Making the world a cleaner coding place, on both iOS and Android.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store