Build an iOS App with a revenue 1,338$ / mo

A full tutorial will walk with you step by step [Part 2]

Ali Fakih
4 min readMar 7, 2021

In this part, we’re going to talk about how to inject the scenes (ViewController — UIView — SwiftUI) into our App.

If you missed the first part, you can have a look here.

Dependency Injection

We already spoke in the first part about Application Architecture and Design patterns, and how the layers should be set (Data →Domain →Presentation). So what is dependency? it is when something like a class uses some functionality of another class. We can then say that this class has a dependency on class X.

From https://www.freecodecamp.org/

This what we are going to do next. The AppDIContainer is a final class where its lifecycle is the same as the app and will be there as long as the app is alive. To start with this AppDIContainer let us create an empty final class so we can create an instance of it in the AppDelegate.

let appDIContainer = AppDIContainer()

Now we can access it from the AppDelegate .

--

--

Ali Fakih

I'm a software dev & tech enthusiast who loves iOS, Swift, networking & electronics. Follow me for insightful articles on software & tech.