The benefits of Xamarin in providing a single lanugage codebase for cross-platform apps are well known, but how does the Xamarin appraoch translate to the particular requirements of an agency? In this talk, Mick Byrne, founder and owner of We Make Apps, describes benefits reaped and challenges faced since pivoting his agency in 2015 to embrace Xamarin for all new projects, covering maximising code sharing, staff (re)training, ongoing support and dealing with 3rd party dependencies.
1. Leveraging Xamarin
Using Xamarin in an agency environment
Presented at MonkeyFest18 at the Microsoft Reactor in Sydney, on Sat 10 November 2018
2. HELLO
I’m Mick Byrne, owner of We Make Apps
We Make Apps in business since March
2011.
Since 2015, published more than 20
different apps built using Xamarin.
Our very first app was for ‘Unfuddle’
using MonoTouch in 2011.
3. AGENDA
What makes agency apps different?
Leveraging Xamarin
Challenges using Xamarin
Case studies
Conclusions and questions
4. AGENCY APP DEVELOPMENT
Requirements - every project is unique
Design - public facing apps need to look and feel amazing
Juggling - multiple concurrent projects, plus ongoing support and
maintenance
5. AGENCY DEVELOPMENT - REQUIREMENTS
Every project presents with unique requirements.
Need to be across lots of frameworks - VOIP, Bluetooth LE,
Augmented Reality, Share Extensions, Audio and Video.
6. AGENCY DEVELOPMENT - DESIGN
High expectations means no
shortcuts.
Custom views and smooth
transitions
Too detailed and specific for a
‘common denominator’
approach like Xamarin Forms.
Example : Davey Pool Pump
7. AGENCY DEVELOPMENT - JUGGLING
Multiple concurrent projects, tight deadlines and small budgets.
Small teams, often just one developer.
Constant support and maintenance of existing apps.
Cross platform always
8. LEVERAGING XAMARIN
Code sharing - shared projects, Xplat views and controller, coding conventions.
Development process - ensures each platform is developed in parallel, much
easier support and maintenance.
Re-usable components - single API for the most common tasks.
White labelling - solution structure for brand-able apps.
Internationalisation - all user exposed copy is shared.
Shared server code - a thin Models project can be used in server and client
code.
9. LEVERAGING XAMARIN - CODE SHARING
Code sharing between iOS and
Android apps has huge benefits.
Techniques we use to share
code:
Shared projects.
Linked assets.
Build events.
storePlay cloc summary
Language files blank comment code
SHARED CORE 99 1452 779 9817
SHARED UI 61 726 34 5514
ANDROID 50 2741 2044 7453
IOS 40 512 26 3104
WINDOWS 43 411 40 3032
HEADLESS 7 98 6 549
Android: 67% shared
iOS: 83% shared
Windows: 84% shared
Headless: 96% shared
10. CODE SHARING - SHARED PROJECTS
Shared projects are at the core of
code sharing in Xamarin.
Models, networking code and
services exist in shared project only.
Every view and controller split over
two files using partial classes.
11. CODE SHARING - LINKED ASSETS
All assets exist in the `Shared`
folder on disk.
Linked as `Resources` in the iOS
and Android solution.
Only exceptions are the app
icon and (for iOS) launch screen
images.
12. CODE SHARING - XPLAT CONTROLLERS
Xamarin makes it easy to share networking code, models and
business rules.
Most important is sharing controller code, because the iOS
UIViewController doesn’t align well with Android Fragment
or Activity.
We built our own Android Controller base class (no fragments
involved) to align lifecycle events with iOS UIViewController.
13. CODE SHARING - THE ANDROID LIFECYCLE
Biggest obstacle to deep code sharing is aligning the lifecycle of
view controllers vs fragments/activities.
We chose the iOS view controller lifecycle, built an Android class
that matched.
Benefits are enormous.
14. CODE SHARING - XPLAT VIEWS
Our Xplat views allow for initialisation and model binding in
shared controllers.
Not a ‘common denominator’ of iOS and Android views, more like
a superclass of views with methods to cast to native.
15. CODE SHARING - BUILD EVENTS
Single BuildConfig.cs file
contains all settings for both apps
for all build configurations.
Before Build event, runs
BuildConfig.sh - compiles
BuildConfig.cs to a .exe and
executes it, setting all .plist and
.manifest values.
16. LEVERAGING XAMARIN - DEVELOPMENT PROCESS
Xamarin encourages us to develop cross-platform apps in
parallel.
Feature-by-feature on both platforms, especially for lone dev.
Prevents code, and developers, drifting into a single platform-
centric approach.
Biggest benefit is in later support and maintenance.
17. LEVERAGING XAMARIN - RE-USABLE COMPONENTS
Unique requirements of apps in agency development mean re-
usable UI components not worth it.
Our one exception is the Xplat alert view.
We built components to expose a standard, cross-platform API -
HTTP, location services, settings, etc. - hopefully will be
superseded by Xamarin Essentials.
18. WHITELABELLING
Tree of shared projects,
separate functionality from a
brand-specific ‘skin’.
Brand specific projects are
very thin, with bulk of the
code shared between
brands.
20. LEVERAGING XAMARIN - SERVER AND CLIENT CODE
For large projects, a shared Models.csproj can be used in
both server and client code.
Classes in this project represent JSON serialised classes only.
Assumes you’re using .NET on your server.
Takes a bit of forethought, but works so well.
21. CHALLENGES USING XAMARIN
3rd party libraries - have to write your own Xamarin bindings
Staff and Community - Smaller dev community, less devs
Tools and publishing - niggly bugs cause lots of pain
22. XAMARIN CHALLENGES - 3RD PARTY LIBRARIES
Almost no SDKs come with existing Xamarin bindings.
Microsoft does a good job with main SDKs, especially all the
Android SDKs from Google, but for everything else it’s not so
straightforward.
We’ve written our own bindings for plenty of libraries, but it’s a
specialised skill and takes time.
23. XAMARIN CHALLENGES - DEV COMMUNITY
Much smaller community of developers to help with problems.
StackOverflow is OK, but often you need to learn to translate Swift and
Java answers into Xamarin in your head.
Finding staff can be harder, easier to teach an app developer C#, than to
teach a .NET developer to build apps.
Understanding the framework is more important than understanding the
language.
24. XAMARIN CHALLENGES - TOOLCHAIN AND PUBLISHING
Visual Studio is an excellent IDE, but releases of VS for Mac seems
to break things for a while.
Bugs in the signing and publishing process are especially painful, e.g.
iOS apps with Push entitlements, Linker issues on Android.
Xamarin profiler is very expensive, yet not quite as good as tools in
Xcode and Android Studio. Xamarin Test Cloud is very good, but it’s
also relatively expensive.
25. CASE STUDIES
storePlay
Curated, licensed music for business.
Let’s Ride
Pay for rides in shopping centres through an app on your phone.
Davey Pool Pump
Control your pool pump using this app over Bluetooth LE.
WeatheX
Collects crowd sourced data about extreme weather events.
26. CASE STUDY - STOREPLAY
Provides curated, correctly licensed music for
businesses.
Single code base used for iOS, Android and Windows
desktop. Also Headless .NET core application.
Deep audio processing, forks to different libraries by
platform.
Includes code sharing between server and app.
27. CASE STUDY - LET’S RIDE
Users pay for children’s rides in shopping
centres through the app.
Highly customised designs, with great
consistency between iOS and Android.
Integration with Salesforce, Braintree and
custom API from ride hardware supplier,
Nayax.
28. CASE STUDY - DAVEY POOL PUMP
Users can control their pool pump over
Bluetooth LE connection. Allows for manual
control as well as managing a daily or weekly
schedule.
Cross-platform Bluetooth LE implementation.
Localised into 6 different languages.
White-labelled for sister brand Henden.
29. CASE STUDY - WEATHEX
Crowdsourced photos of extreme weather
events are used in climate models in real
time.
Custom map style implementation and
unorthodox user interface.
Unique UX with very streamlined flow to
be used in extreme weather.
30. CONCLUSIONS
Xamarin is a particularly good technology for agency-style app
development
Code sharing
Development process
Ongoing support and maintenance
Some shortcomings, especially having to do Xamarin bindings,
though to be fair Xcode and Android Studio kind of suck too.
31. THE END OF THE PRESENTATION
Thank you
Are we doing questions?
32. STAY IN TOUCH
Mick Byrne
We Make Apps
https://wemakeapps.net
mick@wemakeapps.net
@mikbyrne