Architectures
Xamarin applications can basically be built with two major architecture types: native and layered . I'll explain better:
Native Architectures
They allow you to use the same architecture that would be used if you were making the application using the native language of the platform, by default. It allows you to work exactly as you would in an Objective-C application on iOS or Java on Android .
The advantage of using this architecture is that it is easy to migrate to Xamarin in this way. If you already know the platform in question just do the same thing using C # instead of the native language. The downside is that you will have an application stuck on the platform and will not make use of the advantages of being able to use just one language on multiple platforms.
Layered Architectures
They allow your application to have cross-platform reusable code. Basically you can have something simple and owner in which you separate "in hand" a reusable portion of code and everything else that depends on the platform in different layers. There are more advanced and organized ways of doing this with MVC and MVVM .
MVC - Model View Controller
It is the template that is used on the Web and can be used with Xamarin and C #. This architectural model is entirely made by the developer with the help of libraries such as MonoCross .
MVVM - Model View View-Model
It is a specialization of MVC with a layer that takes care of what can be abstracted and with the automatic connection ( binding
) of the model with the view. It is the same architecture model that Microsoft uses in WPF
- Windows Presentation Foundation
. This architecture model is made entirely by the developer with the help of libraries such as MvvmCross .
How to choose what to put on each layer
There are some libraries of Xamarin itself that abstracts from various native APIs. Using these libraries with a layered architecture means you only need to rewrite the view layer for each platform.
-
Xamarin.Mobile abstracts things like the camera, the contacts, the GPS
-
Xamarin.Auth allows you to authenticate with OAuth 1.0 and 2.0
-
Xamarin.Social allows you to integrate Facebook, Twitter, App.net and Flickr
Should I use separate solutions?
The simplest answer is no. It is best that it be a solution with all projects only, so that common projects can be read and uploaded at once. This will make it easier to maintain.
Remember that common libraries should not use platform-specific APIs or features and should instead be compiled using Portable Class Libraries