How to split navigation from coordinator instantiation using generic factory

MVVM is one of the most common architectures to realise apps. The goal of this architecture is to lighten the ViewController responsibilities by moving the presentation logic to another component, the ViewModel.

MVVM does not explain directly how to tackle the navigation from one ViewController to another. …


What to keep in mind when writing your modules and libraries

People writing on whiteboard

One task that I enjoy is writing libraries and modules to speed up my colleagues.

One of the most rewarding moments happened when a colleague come to thank me for a library I was working on that saved him almost a week.

Today I want to share five principles I…


Let’s override navigation in UINavigationController

Lighthouse

Having a mature framework like UIKit is usually a very good thing. We can trust that the components work as they are described. We have a huge number of resources, and it’s very likely that someone else already had a similar problem and that there is a solution for that.


How to properly use the MVVM pattern in SwiftUI

There are tons and tons of tutorials out there about the topic. However, I couldn’t find anything explaining clearly how to handle complex situations that can happen in a real-world application.

All the examples I could find were basic: they start with a simple view where they put some data…


What they tell you about memory leaks is not completely true

A battery

Swift heavily relies on two types of entities: structs and classes. The main difference between the two is that structs are value types while classes are reference types.

The two differ in how Swift handles them in memory. Reference types are allocated in the heap, while value types are allocated…


Encode and decode a schemaless JSON without losing the type safety

Laptop on desk

When developing an app or a library, it can happen that we need to parse a JSON that has no fixed or known schema. It can also happen that we need to write an API that allows our users to send different kinds of data to a service. …


Test the network layer easily

Laptop on desk

Most apps have to perform network calls. We need them to retrieve data from a service, perform a login, or send data to a remote server.

At the end of the day, we often end up writing an abstraction over the networking layer, and we want to test this layer.


A proposal on how to test reference cycles in your Swift app or library

Smartphone on table

Inspired by this post by Vincent Pradeilles, I started thinking about how to create unit tests to check that our classes are deallocated correctly.

The Problem

The main reason why classes are generally not properly deallocated in Swift is because of reference cycles.

In their simplest form, we have an instance of…


Handle keyboard events automatically in any view using AutoLayout and Combine

Handling the keyboard is one of the annoying tasks that iOS developers have to do every time there is a screen with some input. It is also something that the platform should provide us for free.

At the end of the day, the keyboard is shown and hid by the…


Easily animate views in your iOS apps

Smartphone and laptop on desk

In my article last week, we explored how to write the layout of our apps using AutoLayout.

This technology is more declarative than manipulating the frames. Although it is more verbose, we can easily create a small Domain-Specific Language (DSL) to simplify it. …

Riccardo Cipolleschi

Hey there, I’m Riccardo. Senior iOS Engineer at TrueLayer and ex-Spooner. I breathe iOS development: apps and tools. I love to share my knowledge with others.

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