Almost a year ago, I started to be a lot more interested in Xamarin, since I already was something of a Mac guy writing software for the Microsoft platform. I've been working in Windows VM's via Parallels for years. At work, the firm we were working with to build out our mobile apps was using Xamarin too. For me, it wasn't just about being able to use C# to write apps for iOS and Android, it was the idea that you could share a lot of code. That's pretty exciting.
So around the holidays, I started to make a bona fide attempt at porting some portion of my super simple CoasterBuzz Windows Phone app to at least one of the other two platforms. It's as simple as it looks... it makes some JSON API calls and fills screens with it. It's entirely unremarkable.
My attempt was not a good experience. The first part of my attempt involved creating a shared library to call just one of the endpoints (the one that gets all amusement parks). I tried using the HttpClient PCL, but it didn't seem to work on both platforms. I ended up doing some lightweight DI to inject the platform specific versions in. When I did get to the platform specific projects, it wasn't at all clear if the async/await paradigm worked. More specifically, I wasn't sure how to make it work in the last mile with the UI. The iOS design experience was so poor linking to Xcode and Apple's designer, and it mostly just crashed.
Quirky didn't quite describe that experience. Awful would be a better word. I gave up.
Now Xamarin 3 is out, and there are three important changes (among others). The first is that they have a solid iOS designer that does not depend on the Apple nonsense. It works from within Xamarin Studio, and if you could afford it, also Visual Studio. The second big win is something called Xamarin.Forms, which is an abstraction around the platform controls. As they describe it, you can specify a button in code or XAML, and get the right button on each OS. You can even override to create specific controls. The final new win is NuGet package management built into the IDE.
OK... good enough for me. I decided to give it another shot. I started from the same place, creating a shared library to hold the data fetching code. I added NuGet packages for JSON.net and the HttpClient libraries, and wrote some basic code to fetch that amusement park list. Bam, it compiles.
Next step was a base project for the app. I created a single XAML page with a button and a listview. I wired up a handler for the button that called the data fetching code from the other project, and it let me keep the async/await stuff. Then two new projects, one for iOS and one for Android, and the required start up code described in their tutorial.
Once I had all of the required SDK's and such, I ran each version in the emulators... and they worked.
Yes, the Android SDK and emulator scene is a mess at first, but I can't believe that this just worked. I'm honestly a little blown away.
My first impression of the updated product is pretty strong. I'm still not crazy about the pricing because of the per-platform requirements, because it makes it difficult for the hobbyist or developer trying to learn new stuff to justify the expense. It's not that I'm against paying for good software, I just think it's a little much if your job doesn't pay for it. With more and more people working in contract arrangements, that's going to get worse.
My next move is to research the recently released preview of the Cordova stuff for Visual Studio. The Xamarin drumbeat insists that native is better for many reasons, but with people getting new phones every two years and the hardware being so good, I'm not sure that something browser based isn't good enough inside of an app container. I kind of like what Basecamp had to say about hybrid approaches, so I want to explore that. The VS story is even more compelling with Typescript.