Testing iOS Apps


Writing tests in iOS apps is a touchy subject. Not everyone is so privileged to be able to write tests full-time, for different reasons.

Some people have full control over their development process and choose not to write tests, maybe because they have had a bad experience with it or they just don’t see the value in them.

I would argue that if you are part of a smaller team, tests can even be more helpful than in big corporations.

A big corporation might have dedicated QA team, but if you are one of 2 developers, then you are often responsible for ensuring quality and reliability of your work, its considerable pressure because each feature you write might break something else in your app.

Let us look at practices and tips for writing maintainable tests in your iOS Apps.

How hard would it be to adjust your iOS app in real-time?


Iterating over design that needs to be reflected in code can be tedious and time-consuming.

Typically the designer works in graphics editing software and then submits flat art to the developer who implements the design in code. Refining the design requires going through the same laborious process.

Even harder if we want to support multiple themes in our apps. How would we even approach that if we were using Interface Builder?

Let’s look at how we can approach implementing a simple library that could solve all of the above concerns.

Meta-programming in Swift


Swift has very limited runtime support and no meta-programming features.

I created a new tool that changes that, it’s called Sourcery

Using it offers many benefits:

  • Write less repetitive code and make it easy to adhere to DRY principle.
  • It allows you to create better code, one that would be hard to maintain without it, e.g. performing automatic property level difference in tests
  • Limits the risk of introducing human error when refactoring.
  • Sourcery doesn’t use runtime tricks, in fact, it allows you to leverage compiler, even more, creating more safety.
  • Immediate feedback: Sourcery features built-in daemon support, enabling you to write your templates in real-time side-by-side with generated code.

Better MVVM setup with POP and Runtime


Even if we are writing pure Swift code in our app, we still deal with Objective-C Frameworks like UIKit.

Let’s take a look at how we can improve our MVVM architecture by leveraging a little bit of Objective-C runtime and Protocol Oriented Programming.

Investing time into developer tools


As I open source another framework this week, I wanted to share few thoughts about building developer tools.

Developers are lazy creatures, we like to automate stuff, we write scripts, use File Automation to get rid of repetitive work.

One would think that we’d use the same principles in our jobs, yet I’m constantly surprised how few developers actually invest their time into building tools and setting up processes inside their app to ease their day to day work.

Setting up pre-commit hook for iOS


Many of us already write unit tests and run continuous integration servers, we can also leverage great tools like Danger to easily add some checks to the pull requests.

If we’d like to prevent some common mistakes from appearing in the repo in the first place, we can use pre-commit hook.

Logging in Swift


Logging is one of the rare cases when you could probably justify having a singleton, but with Swift Protocol Extension you don’t need to.

Let’s integrate Logging in a way that:

  • Doesn’t cause 3rd party dependencies to leak across your codebase
  • Hides the existence of singleton from the codebase
  • Supports writing fully testable code
  • Ability to suppress logs from specific modules or classes

iOS Architecture


I recently did a talk in Prague about iOS Application Architecture, you can watch it here.

8 Books that everyone should read


Looking for new books to read?

Programming


What is programming?

For me it has always been about solving problems, and analytical thinking.

Does it matter what language or platform you solve problems on? How do you learn more on your selected platform?