- Book Forum
- Animation: Building Xamarin mobile apps using MVVM helps you to share most of your code between iOS and Android.
- Animation: Xamarin provides a mobile optimised developer lifecycle.
- Animation: The command pattern encapsulates actions inside an object, the same as a genie encapsulates the ability to grant wishes.
- Slideshare: How can I build cross-platform, native apps while maximizing my code re-use?
Xamarin is a toolset that allows you to write native mobile apps in C# and run them on both iOS and Android devices. What makes Xamarin stand out from other cross-platform tools is that it gives you the ability to share large portions of code across these two platforms while still letting you write native apps that can take full advantage of the device and OS features specific to each platform. And since Xamarin was recently acquired by Microsoft, you can be sure the ecosystem will continue to grow - Xamarin has become a hugely important part of Microsoft's "any developer, any platform" mantra.
Xamarin in Action teaches you how to build Xamarin apps on iOS and Android from scratch while maximizing code re-use. This layer-by-layer guide starts by showing you the MVVM design pattern and explaining how it increases code sharing. Next, you'll start building an app from the ground up. You'll learn all the different layers inside a well written Xamarin app and discover how most of your code can be shared between iOS and Android. You'll look at how this code sharing can be best designed to allow unit testing of your business layer as well as your UI logic. Then you'll dig in to code that can't be shared, like user interface code that's device specific. Finally, you'll learn how to take your app from final code to a tested and deployed version on the relevant store. By the end, you'll be able to build a high quality production-ready Xamarin app on iOS and Android from scratch with a high level of code reuse.
"Easily the best and most comprehensive resource available on Xamarin development. Based on the initial 8 chapters, I do not think the author has left anything uncovered."
~ Krishna Anipindi
"The book deals with two most important upcoming trends in IT, mobile development and code reuse (across platform). The knowledge in these 2 fields go a long way together. The author demonstrates a good understanding of these 2 topics and clubbed with the practical examples, this book stands true to its name...it'll get you in action."
~ Prabhuti Prakash
"A clearly written and informative guide on how to get up and running creating your own cross platform apps using Xamarin."
~ Eric Sweigard
Part 1: Getting started with native cross-platform apps
1. Introducing native cross-platform applications with Xamarin
1.1. Introduction to Xamarin mobile apps
1.1.1. Vendor-specific native apps
1.1.3. Xamarin native apps
1.1.5. Xamarin Developer tools
1.2. Mobile-optimized developer lifecycle
1.3. Introduction to production quality apps
1.3.2. Source code control
1.4. Rinse and repeat…
2. Hello MVVM
2.1. What are UI design patterns?
2.2. MVVM - the design pattern for Xamarin apps
2.3. What is Cross-platform code?
2.3.1. Portable Class libraries
2.3.2. Using PCLs to access device specific code
2.4. Getting started - creating your first solution
2.4.1. Requirements - what hardware or software do you need for each mobile platform?
2.4.2. Creating the solution
2.4.3. So what have we just created?
2.4.4. Building and running the apps
2.5. Is this really a cross-platform app?
3. MVVM a deeper dive
3.1. The Model layer
3.1.1. The code should be cross-platform
3.1.2. The code should be testable
3.1.3. The model should represent data and business logic at the domain level not the UI level
3.2. The View Model layer
3.2.1. State and behavior
3.2.2. Value conversion
3.3. The View layer
3.4.1. Source and target
3.4.2. Binding mode
3.4.3. Binding is not cross-platform
3.4.4. Value converters
3.5. The Application layer
3.6.1. View first
3.6.2. View model first
3.6.3. Which one to use?
3.7. Let's revisit our square root calculator app as a whole
4. Hello MVVM a deeper dive
4.1. A deeper dive into our Hello CrossPlatform World app
4.1.1. The model
4.1.2. The view model
4.1.3. The application layer
4.1.4. The view
4.2. Expanding on our Hello World app
4.2.1. Installing the Xamarin Text To Speech plugin
4.2.2. Adding the crossplatform code
4.2.3. Inversion of control
4.2.4. Wiring up the Android UI
4.2.5. Wiring up the iOS UI
4.2.6. Let's review the changes
5. What are we (a)waiting for? An introduction to multi-threading for Xamarin apps
5.1. Why do we need multi-threaded code?
5.2. What are threads?
5.2.1. Buying coffee
5.2.2. So what is a thread?
5.2.3. Quick round-up
5.3. UI thread and background threads
5.3.1. The UI thread
5.3.2. Background threads
5.4. Using tasks to run code in the background
5.4.1. Task and Task<T>
5.4.2. Chaining tasks
5.5. Task results
5.5.1. Polling to see if the task has finished
5.5.2. Waiting on the task
5.5.3. Getting the result from a continuation
5.5.4. Task exceptions
5.6. Updating the UI
5.6.1. The UI task scheduler
5.6.2. Using the power of MVVM
5.7. Async and await
5.7.1. The async and await keywords
5.7.2. Writing your own async methods
5.7.3. Async commands
5.8. Make your app feel responsive
5.9. The foundations have been laid, now its time to start building things
Part 2: From blank solution to an empty, working app
6. Designing MVVM cross-platform apps
6.1. Introduction to designing our cross-platform app
6.2. Designing the UI and user flows
6.2.1. SquareRt - a simple app for calculating square roots
6.2.2. Countr - an app for counting multiple things
6.2.3. Defining user flows and UIs
6.3. Architecting our app
6.3.1. Which layer?
6.3.2. Which thread?
6.3.3. Mapping your code to layers and threads
6.4. Creating the solutions
6.5. Application properties
6.5.1. Android manifest
6.5.2. iOS info.plist
6.6. SDK versions
6.6.1. Android SDK versions and the SDK manager
6.6.2. iOS SDK versions
6.7.1. Linking our apps
6.7.2. Linker options
6.7.3. Stopping the linker doing too much
7. Building cross-platform models
7.1. Building simple model layers
7.2. Unit testing
7.2.1. Creating a unit test project
7.2.2. Creating our first test
7.2.3. What do these tests tell us?
7.3. Building more complex model layers
7.3.1. Services, data models and repositories
7.3.2. Accessing databases
7.3.3. Adding a service layer
7.3.4. Accessing web services
7.4. A recap
8. Building cross-platform view models
8.1. The view model layer
8.1.1. The view model layer inside SquareRt
8.1.2. The view model layer inside Countr
8.2. Adding state and behavior to SquareRt
8.2.1. State inside SquareRt
8.2.2. Exposing behavior via property changes
8.3. Adding state and behavior to Countr
8.3.1. Single value properties
8.3.3. Exposing behavior using commands
9. Building platform specific views - Android
10. Building platform-specific views - iOS
11. Running the app
Part 3: From a working app to a production ready app
12. Testing the app using UITest
13. Instrumentation and monitoring
14. Deploying the app
Appendix A: What are design patterns anyway?
Appendix B: Using someone else's code
Appendix C: UI flows and threads for SquareRt and Countr
- Understand MVVM and how it maximizes code reuse and testability
- Build a mobile app from rough design through final deployable product
- Creating cross platform model and UI logic layers
- Build device specific UIs for iOS and Android
- Test apps through unit and automated UI testing
- Prepare apps for publication with user tracking and crash analytics