6. Native Perf. + UX
Compiles Down to Native Code
Not Interpreted
All Native UX Controls
Full Platform SDK Access
iOS: Selectors/Obj-C Runtime
Android: JNI
Fast Enough for Games
º
9. Community +
Support
Huge C# Community
StackOverflow.com
forums.xamarin.com
IRC + chat.xamarin.com
Great Support
º
10. VS + Xamarin
Studio
Visual Studio
Xamarin Studio
Android Designer
iOS Designer (Beta)
Debugging
AutoComplete
Refactoring
Project Management
Integrated Source Control
12. Design Platform-Specific UX
UX in iOS != Android != Windows
Phone
UX Metaphors are Different:
Navigation Controller vs. Back
Button
Write-Once, Run-Anywhere is
Problematic
Users Expect Native UX
º
17. Code Sharing - Linking vs. PCL
Portal Library Projects - Take a Lot of Work
Great Discussion Here:
http://forums.xamarin.com/discussion/28/challenges-thoughts-loves/p1
Takeaway:
PCL is clean, but difficult to implement
Linking is less “clean” but simpler
Our Recommendation Now: File Linking for Most Projects
Walkthrough Here: Linking
º
18. WP7 + Android
New Blank Solution: "[AppName]"
New C# Lib Project: "[AppName].Core"
Test Project: “[AppName].Core.Tests”
New Mono for Android Project: “[AppName].Droid”
New WP7 Project "[AppName].WP7"
º
19. Shared Data +
Data Access
Layer
Data Access
Layer
SQLite on iOS + Android, C# SQLIte on WP7:
http://code.google.com/p/csharp-sqlite/
SQLite.NET ORM
Use Generics for CRUD Convenience Methods:
TaskDatabase.cs
º
Fast Enough for Games Native UX means that apps look like they belong Full platform SDK Access means that anything you can do in Obj-C on iOS or Java in Android, you can do here. Animation libraries, Media libraries, etc.
Need better graphic for this.
Need Visual Studio Screenshot
A good layered architecture allows for proper separation of responsibility and encapsulation, providing isolation to allow for code changes and maximizing code sharing between platforms. It also provides a pattern-agnostic framework so you can pick and choose which patterns you want to use, and then be flexible to changing them later on. And this is very simple to do. We’ll see later on how to accomplish this with proper namespacing and project setup.
Xamarin supports portable library projects, but they pose practical problems in real-world scenarios because of dependencies. it eliminates the ability to use ifDefs, so you have to do massive architectural refactoring, use the provider/simple dependency pattern, etc. to solve even minor things. Best way, instead is to link your code.
Don’t use .Android - the namespace will cause you hell
You can use SQLite on all three mobile platforms, iOS, Android, and WP7. on iOS and Android, SQLite is bundled with it, and on Windows Phone, you can use the open source C# port. We’ll show later how to easily support this cross platform with the same exact API. Additionally, we recommend SQLite.NET ORM for easy data access. For Data Access, we’ve added some nice convenience methods in TaskDatabase.cs that make the basic CRUD operations a snap with zero code.
Platforms are different. pInvoke is available on iOS and Android, not on WP. SQLite is native on Android and iOS, on WP you have to use the C# lib. Devices also have different features. Cameras are different on nearly every single android device out there. Some devices have location features, some don’t. Some vary, etc.
There are predefined symbols that allow you to use different code, depending on the platform you’re building for. Additionally, you can define your own symbols in Build Settings. Demo of this in use can be found here: TaskyPro :: CoreLib.DataLayer/SQLite.cs
ITask - Interface TaskBase - Task class DialogTask - with MT.D annotations