I've been neck-deep in Xamarin for a little over a week now. After many ups and downs I'm happy to say that — at least for the moment — it seems I'm on the right track.
Currently my goal is extending Tenterhook to Android devices, but I'm laying the groundwork for potential iOS support down the road. This involves quite a bit of planning to avoid messy and redundant code and Xamarin will help me get there. I can put shared code in a .NET Standard library while projects targeting Android and iOS focus on UI-specific implementations.
The conceptual architecture (all subject to change):
After an app is created in Tenterhook Studio, preparing it for Android would be a fairly straightforward process in Visual Studio:
- Generate an Android App (Xamarin) project from a template (perhaps automated by Yeoman?).
- Copy the app's manifest.json and assets (image/audio files) into subfolders under Assets.
- Change the app name and icons.
- Package and ship it!
The UI and shared logic would be handled by Tenterhook.Droid.Core.dll and Tenterhook.Core.dll, no custom code would be required if all goes according to plan.
As of June 11 I'm very optimistic about where things are headed, but there was definitely pain in the early stages. Some random thoughts from the first week:
- Xamarin University has a few decent (and free with sign-in) self-guided courses that helped me ramp up on general Xamarin and Android concepts. Examples: Getting Started with Xamarin, Introduction to Xamarin.Android, and Activities and Intents.
- Setting up emulators is a colossal pain given all the Android SDK and Hyper-V requirements. This was compounded by confusing and outdated documentation, so I set aside emulation and opted to deploy/debug via my Android phone directly. However, I'm pleased to report those docs were updated in the last few days. I'll give emulation another shot.
- The Xamarin Layout Designer is horrendous. Even if you manage to dismiss the random errors, sluggish rendering, and overly aggressive caching, you'll run into cases where the Design and Source tabs inexplicably get out of sync. To "correct" this I've bounced Visual Studio countless times, and on Day 2 I legitimately considered ditching my cross-platform goals for Android Studio instead.
- The build/deploy experience is often slow and buggy. I'll often get a "Build failed" message with no further detail, only to build again with success. Every minor tweak repeats this cycle and results in lots of wasted time.
- Despite all of the above, when the stuff I've learned shows up on my phone it's very exciting. I'm glad I perservered through Xamarin's obvious flaws; the momentum is now building and my goals seem achievable.