Chapter 3. Code Sharing Between iOS and Android
Xamarin's tools promise to share a good portion of your code between iOS and Android while taking advantage of the native APIs on each platform where possible. Doing so is an exercise in software engineering more than a programming skill or having the knowledge of each platform. To architect a Xamarin application for enabling code sharing, it is a must to separate your application into distinct layers. We'll cover the basics as well as specific options to consider certain situations.
In this chapter, we will cover:
- The MVVM design pattern for code sharing
- Project and solution organization strategies
- Portable Class Libraries (PCLs)
- Preprocessor statements for platform-specific code
- Dependency Injection (DI) simplified
- Inversion of Control (IoC)