Dependency Injection, why do you need it? You start your new app with good intentions. You strive to keep the code clean but quickly things go wrong. You hook your app to a set of services, add analytics, add some logging. Quickly you find there are dependencies all over your app. It is almost impossible to run automated tests against your app. Difficult to reproduce strange behaviour users are reporting out in the wild. It might be time for Dependency Injection.
Depend on abstractions. Do not depend on concrete classes
In this series of blog posts we aim to show you how to build a Simple Login Form in Swift. Back in Part 1 we left off with a Login Screen which opens when you run the app. In this part we are going to add a LoginService which will manage user authentication. If the user is already authenticated they will be directed to a Welcome Screen. Users who are not authenticated yet will see a Login Screen.