Slide 1

Slide 1 text

MvvmCross Building Native Cross-Platform Apps Martijn van Dijk @mhvdijk [email protected] github.com/martijn00 speakerdeck.com/martijn00

Slide 2

Slide 2 text

Why Mvvm? View Binder ViewModel Model Button Text 1. Action 1. Action 3. Command 5. Notify change 6. Change data 4. Access data 2. Event handling

Slide 3

Slide 3 text

Why MvvmCross? ■ Cross-platform awesomeness! ■ Support for all major platforms ■ Most advanced Mvvm library for Xamarin and .NET cross platform ■ Large and engaged community ■ Fast release cycle ■ Clean and easy conventions Miguel de Icaza (Xamarin CTO) “I love MvvmCross” ■ Used by many enterprise companies e.g: - Microsoft - Xamarin inc. - Dutch government - Olo - Nokia Scott Hanselman (Microsoft Developer Evangelist) “I am really impressed with MvvmCross”

Slide 4

Slide 4 text

MvvmCross supported platforms ■ Android ■ iOS ■ Windows ■ Xamarin.Forms ■ tvOS ■ Google wear ■ iWatch ■ Mac

Slide 5

Slide 5 text

MvvmCross details Highlights ■ Flexible architecture ■ PCL based ■ Inversion of Control ■ Dependency injection ■ Value Converters ■ Bindings ■ Testable ■ Plugins Resources ■ Github.com/MvvmCross ■ MvvmCross.com ■ Slack (#mvvmcross) ■ Stackoverflow ■ Xamarin Forums

Slide 6

Slide 6 text

Presenters Specifications ■ Customize view presentation ■ Platform-specific ■ Still retain View Model logic ■ Presentation hints Examples ■ Tabs / Panorama ■ Split View / Master-Detail ■ Fragments ■ Modals ■ Hamburger menu

Slide 7

Slide 7 text

Plugins ■ Messenger ■ Phone Call ■ Picture Chooser ■ SQLite ■ Visibility ■ Web Browser + Many More! MvvmCross ■ Accelerometer ■ Download Cache ■ Email ■ File ■ Json ■ Localization ■ Location Plugins available at https://github.com/MvvmCross/MvvmCross-Plugins

Slide 8

Slide 8 text

Generics ■ MvvmCross uses CoC (Convention over Configuration) by default - LoginView > LoginViewModel ■ Generics can be used too - LoginView : MvxActivity - MainView : MvxActivity ■ Possible to override in setup.cs - protected override IDictionary GetViewModelViewLookup()

Slide 9

Slide 9 text

IoC (Inversion of Control) 1. Use interfaces 2. Define implementation of interfaces at runtime 3. Job done! :) ■ Singleton: Mvx.RegisterSingleton(); ■ Lazy: Mvx.ConstructAndRegisterSingleton(); ■ Dynamic: Mvx.RegisterType(); Mvx.Resolve();

Slide 10

Slide 10 text

Material Design support for MvvmCross ■ Design - NavigationView - FloatingActionButton ■ AppCompat - android:Theme - Toolbar - DrawerToggle ■ V4 - DrawerLayout - SwipeRefresh - ViewPager (FragmentStatePager) ■ LeanBack ■ Preference - Compat Fragments ■ Fragging - V4 Fragments - MvxCachingFragmentActivity ■ RecyclerView - ItemTouchHelper for Xamarin

Slide 11

Slide 11 text

Other Material & Android support libraries ■ Cardview ■ Pallete ■ Gridlayout ■ Mediarouter ■ V8 Support ■ V13 Support ■ Annotations support ■ Custom tabs ■ Percent support ■ Recommendation support

Slide 12

Slide 12 text

Tips ■ Keep it simple ■ Separation of Concerns ■ Don’t try to invent the wheel again, use plugins, samples, etc ■ Use Xamarin player or GenyMotion as emulator for Android ■ Test all changes (UITest, Unit test, etc) ■ Use a common PCL profile (profile7 or profile259) or .NET Platform Standard ■ Enable “Analysis” XS > Preferences > Text Editor > Source Analysis > Enable ■ Get help on Slack: https://xamarinchat.herokuapp.com/ ■ Follow influencers on Twitter #Xamarin #MvvmCross ■ Be involved in the community!

Slide 13

Slide 13 text

Questions?