In part 1, we discuss about some steps that we have to take when experimenting with Xamarin. In this part, we will discuss about architecture between iOS and Android.
In the normal process, iOS and Android will share some similar architecture styles. Both will have UI layer, Model Logic layer and Database Layer. Before trying to use Xamarin, we need to make sure that both of our code platform will share similar architecture.
So, the first step was to try bring both our platform into a V.I.P.E.R architecture and share the same code process. VIPER is more commonly used in iOS and there are not many resources for Android, but we still have to force the Android codebase to use VIPER. You can read more about VIPER here.
With this architecture, we hope to reuse our Interactor (Business and Controller Logic), Presenter (View Logic), Worker (Data Logic) and Models as much as possible. Any code that is different between iOS and Android will be integrated at runtime using a Protocol / Interface approach.
We take this as a first step, because if we fail to use Xamarin, we can still have a nice codebase and a familiar structure between iOS and Android. This allows us to port code from iOS to Android easily in the future