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

Xamarin: from zero to hero

Xamarin: from zero to hero

In this session at the SDN event of april 8th 2016 I handled everything you need to know to start developing with Xamarin. Partly Dutch.

Avatar for Gerald Versluis

Gerald Versluis

April 08, 2016

More Decks by Gerald Versluis

Other Decks in Technology

Transcript

  1. www.bestppt.com XAMARIN: FROM ZERO TO HERO Alles wat je nodig

    hebt om te beginnen met Xamarin development
  2. Op de agenda… 6 1 Wat is Xamarin? Hoe onderscheidt

    Xamarin zich van de rest? Xamarin 2 Wat is Xamarin.Forms? Hoe werkt het? Wat zijn de mogelijkheden? Xamarin.Forms 3 DependencyService, Custom Renderers Deep dive 4 Niet te missen NuGet packages voor het ontwikkelen met Xamarin NuGet Nuggets 5 Samenvatting, lessons learned, applaus en pauze houden! It’s a wrap
  3. Verschillende manieren van ontwikkelen 9 Bouw dezelfde app meerdere keren

    • Meerdere teams • Meerdere code bases • Verschillende tools en talen silo/vendor
  4. Verschillende manieren van ontwikkelen 10 Bouw één app voor alle

    platformen • Grootste gemene deler • Browser fragmentatie • Cordova, PhoneGap • Updates niet altijd via de App Store hybride
  5. Verschillende manieren van ontwikkelen 11 Bouw één app voor alle

    platformen • Native User Interface • Native Performance • Gedeelde code over alle platformen • C# & .NET Framework (inclusief C# 6.0!) • Full API Coverage Xamarin way
  6. “ Waarom Xamarin? 13 Xamarin.iOS does full Ahead Of Time

    (AOT) compilation to produce an ARM binary for Apple’s App Store. Xamarin.Android takes advantage of Just In Time (JIT) compilation on the Android device. “ Native performance
  7. Hoe gebruik je Xamarin? 18 Visual Studio Alles werkt zoals

    je gewend bent • Alle platformen in een solution • Solution te openen in VS & XS • Alle Visual Studio plug-ins te gebruiken • iOS & Android designer
  8. Hoe gebruik je Xamarin? 19 Xamarin Studio Geoptimaliseerd voor cross-platform

    development • Visual Studio kloon inclusief meeste belangrijke features • iOS & Android designer • Snelheid!
  9. 21 Anything you can do in Objective-C, Swift, or Java

    
 can be done in C# with Xamarin (using Visual Studio) “
  10. Wat is Xamarin.Forms? 25 Cross-platform UI framework te gebruiken op:

    • Android 4.0+ • iOS 6.1+ • Windows Phone 8.x (Silverlight) • Windows Phone 8.1 (RT) • Windows 10 (UWP)
  11. Traditionele Xamarin vs. Xamarin.Forms 26 Shared UI Code Up to

    99% code sharing, always some specific (initialisation) code. 60-80% code sharing
  12. What’s included? 27 • 40+ Pages, Layouts en Controls •

    Te gebruiken vanuit code of XAML • Two-way Data Binding • Navigation • Animation API • Dependency Service • Messaging Center “ If you are used to MVVM development you should feel right at home
  13. What’s included? (worst slide ever…) 30 Controls ActivityIndicator BoxView Button

    DatePicker Editor Entry Image Label ListView Map OpenGLView Picker ProgressBar SearchBar Slider Stepper TableView TimePicker WebView EntryCell ImageCell SwitchCell TextCell ViewCell
  14. Xamarin.Forms in actie 31 Use a single API to generate

    native, platform-specific user interfaces At runtime, each Xamarin.Forms page and its controls are mapped to platform-specific native user interface elements “ “
  15. To Forms or not to Forms? 33 Xamarin.Forms best geschikt

    voor: • Weinig platform specifieke functionaliteit • Code sharing over custom UI • Ontwikkelaars met XAML kennis Xamarin.iOS/Android best geschikt voor: • Veel platform specifieke functionaliteit • Custom UI over code sharing • Veel gebruik van native APIs
  16. Platform specifiek 34 Platform specifieke code uitvoeren middels delegates Kan

    gebruikt worden om per platform een specifieke waarde te voorzien Device.OnPlatform
  17. Ingebouwde platform specifieke features 36 Device.OpenUri
 Openen van een URL

    Page.DisplayAlert
 Toont een messagebox Device.StartTimer
 Acties uitvoeren op interval Device.BeginInvoke OnMainThread UI thread marshalling Xamarin.Forms.Maps Toont kaarten en locatiediensten
  18. DependencyService 40 Implementeer de interface in het platform project Registreer

    deze bij de DependencyService (boven namespace) Roep abstractie aan vanuit gedeelde code
  19. MyFirstEntry_Android Xamarin.Platform. Android.EntryRenderer MyFirstEntry_iOS Xamarin.Platform. iOS.EntryRenderer Custom Renderers 41 Maak

    je eigen implementatie van hoe een control naar native wordt vertaald Entry MyFirstEntry Xamarin.Platform. Windows.EntryRenderer MyFirstEntry_WinPhone
  20. NuGet packages die we allemaal zouden moeten gebruiken! 43 Xamarin.Plugins.Settings

    Simple type (user) settings Xamarin.Plugins.Connectivity Network connectivity ACR.UserDialogs Alerts, loading, ActionSheets FreshMvvm Lightweight, easy to use MVVM framework PropertyChanged.Fody INotifyPropertyChanged made easy FFImageLoading Image caching, effects, etc. Polly Fluent exception handling Refit Type-safe REST library Let op! Bij Forms vaak packages ook installeren op platform project!
  21. Lessons learned 45 1 Do not underestimate publishing 2 Upgrading?

    Backup! 3 4 Test altijd op een fysiek apparaat Weinig grip op je app in het wild
  22. Leuk voor thuis 46 1 Xamarin documentatie 2 Xamarin forums

    3 4 5 https://developer.xamarin.com/ https://forums.xamarin.com/ Xamarin GitHub https://github.com/xamarin/ Planet Xamarin http://planet.xamarin.com/ Xamarin University https://www.xamarin.com/university