Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Starting a MvvmCross project

Starting a MvvmCross project

Martijn van Dijk

February 11, 2016
Tweet

More Decks by Martijn van Dijk

Other Decks in Technology

Transcript

  1. 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
  2. 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”
  3. MvvmCross supported platforms ▪ Android ▪ iOS ▪ Windows ▪

    Xamarin.Forms ▪ tvOS ▪ Google wear ▪ iWatch ▪ Mac
  4. 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
  5. 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
  6. 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
  7. Generics ▪ MvvmCross uses CoC (Convention over Configuration) by default

    - LoginView > LoginViewModel ▪ Generics can be used too - LoginView : MvxActivity<LoginViewModel> - MainView : MvxActivity<SomeDifferentNameViewModel> ▪ Possible to override in setup.cs - protected override IDictionary<Type, Type> GetViewModelViewLookup()
  8. IoC (Inversion of Control) 1. Use interfaces 2. Define implementation

    of interfaces at runtime 3. Job done! :) ▪ Singleton: Mvx.RegisterSingleton<T>(); ▪ Lazy: Mvx.ConstructAndRegisterSingleton<T>(); ▪ Dynamic: Mvx.RegisterType<T>(); Mvx.Resolve<T>();
  9. 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
  10. Other Material & Android support libraries ▪ Cardview ▪ Pallete

    ▪ Gridlayout ▪ Mediarouter ▪ V8 Support ▪ V13 Support ▪ Annotations support ▪ Custom tabs ▪ Percent support ▪ Recommendation support
  11. 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!