I already talked about the subject of Dependency Inversion here and of course the way to implement Dependency Inversion is to use Dependency Injection.
First let’s go back to what is Dependency Injection. Dependency injection is used to inject real implementations into a class that uses abstract interfaces instead. So let’s say a Presenter Class uses of View Class. If you are using SOLID, then your Presenter Class will “see” the View Class thru an abstract interface (a contract) and thus the dependency to the View Class will be reversed as you can see in the Fig-1.
When this is done, you can “insert” whatever View in the Presenter as long as it respects the View Protocol contract.
To do the insertion, you will use Dependency Injection. There are 2 types of Dependency Injection :
In Part 1, we saw how to integrate ReactNative inside a Swift project using Cocoapods. Now, before starting to create a ReactNative View and integrate it into our project.
First, let’s take a quick tour of how ReactNative works.
I will not dive in depth (first because I don’t have enough expertise so far and second because it could take a complete book to make it) but at least I will reveal a little bit of the magic behind ReactNative from what I understood and read. There’s a very nice talk from Peggy Rayzis about this subject that you can watch here.
For this week, I want to give a clear example of the type of architecture that I’m trying to push on the projects I work on. Some of you probably already know VIPER. It tends to become a classical architecture in iOS development and in other platforms like Android. VIPER goes for :
V : View
It was inspired by the Onion Architecture or Clean Architecture pushed by Robert Cecil Martin, more known as Uncle Bob.