Chapter 2. Sharing Code between Platforms

As we mentioned in the previous chapter, in mobile development there are features that we can share between platforms and features that need to be platform specific.

In this chapter we will explore all the ways we have in Xamarin to share code between platforms.

We will understand and develop a cross-platform pattern called Model-View-View-Model (MVVM) that helps us to separate the business and presentation logic of our application from its user interface. We will use this paradigm in the rest of the book.


The business logic is the part of a program that determines how data can be displayed, stored, created and changed.

The presentation logic is the part of the program that describes how and when business ...

Get Xamarin 4 By Example now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.