Shortcomings of the default SwiftUI dependency injection mechanism

One of the main topics to master to create scalable and maintainable applications is Dependency Injection. SwiftUI comes with a comfortable API for injecting dependencies: the EnvironmentObject API, composed of a property wrapper and a view modifier.

Despite these APIs being very comfortable, they have several limitations that make them…

How to inject dependencies and pass data around with a clean MVVM architecture

After writing the Composing SwiftUI Navigation article, some people contacted me with very kind words and a few questions. The main topic that was puzzling them was how to pass data and dependencies from one module to another.

There are two tricky points that make this harder:

  1. We want to…

Creating an auto-expanding list in SwiftUI could be harder than expected

SwiftUI is the declarative framework released by Apple in September 2019. It promises to revolutionize the way in which we write our apps, not only on iOS but also on macOS, watchOS and tvOS.

The first version of the framework was limited and with some performance issues. Apple released 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