Mobile design patterns

Mobile design patterns

31f45d5a0834773c3ac146401640ad1f?s=128

Alexandra Marin

May 11, 2017
Tweet

Transcript

  1. Mobile design patterns Alexandra Marin @ ITAKE Unconference 2017 @xmonodev

    crossplatform.io
  2. Hello! { } #mobile #designpatterns #itakeunconf crossplatform.io

  3. Design code that runs cross-platform { crossplatform.io } #mobile #designpatterns

    #itakeunconf crossplatform.io
  4. Overview { crossplatform.io } #mobile #designpatterns #itakeunconf crossplatform.io

  5. The mobile problem { crossplatform.io } #mobile #designpatterns #itakeunconf

  6. Target universal features { crossplatform.io } #mobile #designpatterns #itakeunconf

  7. Enhance experience based on device capabilities { crossplatform.io } #mobile

    #designpatterns #itakeunconf
  8. Platform-independent code with Xamarin { crossplatform.io } #mobile #designpatterns #itakeunconf

  9. Platform-specific code with Xamarin { crossplatform.io } #mobile #designpatterns #itakeunconf

  10. Case study #1: Different capabilities Case study #2: Different platform

    { crossplatform.io } #mobile #designpatterns #itakeunconf
  11. Taking a selfie #mobile #designpatterns #itakeunconf crossplatform.io

  12. { crossplatform.io } #mobile #designpatterns #itakeunconf Facade design pattern crossplatform.io

  13. //On platform if(deviceHasCamera) { //Take photo via Camera app //Apply

    resizing //Save it via File Manager } else { //Choose from gallery } { crossplatform.io } #mobile #designpatterns #itakeunconf crossplatform.io
  14. { crossplatform.io } #mobile #designpatterns #itakeunconf //Shared code camera.ReturnPhoto(); crossplatform.io

  15. Save the date #mobile #designpatterns #itakeunconf crossplatform.io

  16. Bridge design pattern { crossplatform.io } #mobile #designpatterns #itakeunconf crossplatform.io

  17. { crossplatform.io } #mobile #designpatterns #itakeunconf //Shared code class MyCalendar

    { ICalendar calendar; void SaveTheDate() { calendar.AddEvent(); } } crossplatform.io
  18. { crossplatform.io } #mobile #designpatterns #itakeunconf //iOS iOSCalendar : ICalendar

    { AddEvent() { //add event with //EventKit } } crossplatform.io
  19. { crossplatform.io } #mobile #designpatterns #itakeunconf //Android DroidCalendar : ICalendar

    { AddEvent() { //add event with //CalendarContract } } crossplatform.io
  20. Inversion of Control { crossplatform.io } #mobile #designpatterns #itakeunconf

  21. Service locator { crossplatform.io } #mobile #designpatterns #itakeunconf

  22. //Construct on platform Locator.RegisterType <ICalendar, iOSCalendar>(); //Use in shared code

    Locator.Resolve<ICalendar>(); { } #mobile #designpatterns #itakeunconf { crossplatform.io }
  23. Dependency injection { crossplatform.io } #mobile #designpatterns #itakeunconf { crossplatform.io

    }
  24. { crossplatform.io } #mobile #designpatterns #itakeunconf //Construct on platform IoC.RegisterType

    <ICalendar, iOSCalendar>(); //Gets injected in shared class constructor public SharedClass(ICalendar cameraHelper) { crossplatform.io }
  25. Summary { crossplatform.io } #mobile #designpatterns #itakeunconf { crossplatform.io }

    crossplatform.io
  26. Ask Me Anything crossplatform.io or @xmonodev { crossplatform.io } #mobile

    #designpatterns #itakeunconf { crossplatform.io } crossplatform.io