20 years later, Microsoft's still hammerin' Xamarin: Bunch of improvements on the way for cross-platform coding toolset
- Reference: 1585303206
- News link: https://www.theregister.co.uk/2020/03/27/xamarin_improvements/
- Source link:
The history of Xamarin goes back to the earliest days of .NET. In 2001, when C# and the .NET platform were still in preview, Miguel de Icaza (co-founder of the GNOME project) announced the open-source Mono project. Mono is an implementation of the .NET Framework for Linux, later supplemented by Mac and other platforms. In 2009, when Mono was owned by Novell, the team discovered demand for targeting Apple's iPhone with .NET code, and created MonoTouch, a C# wrapper for iPhone APIs.
In his [2]announcement back in 2009, de Icaza noted that MonoTouch uses native iPhone controls. "It would not be a cross-platform API and it would tie developers to the iPhone platform, but it would also mean that applications would look and feel native, and developers would get closer to the iPhone," he said. In January 2011, de Icaza announced [3]Mono for Android . By that time Novell had been acquired by Attachmate, and later in 2011 the Mono team left to form a new company called Xamarin. Aware of a mobile-shaped hole in its developer platform, [4]Microsoft acquired Xamarin in 2016 , and bundled the Xamarin tools with Visual Studio.
The Xamarin team insisted for years that a cross-platform GUI framework would be a mistake, preferring to share only non-visual code and to build a native GUI for each platform. Developer demand was there, though, and [5]in 2014 the company delivered Xamarin Forms , which lets you define a basic GUI using a variant of XAML (different from that used by Microsoft's Windows Presentation Foundation or Silverlight), an XML language. Xamarin Forms still uses native controls. Take-up exceeded the company's expectations, since it turns out that the extra productivity from shared GUI code often outweighs any disadvantages.
Fast forward to 2020, and Xamarin remains the obvious path for developers with existing C# code or skills who now need to target iOS and Android. Xamarin can also target macOS and UWP (Universal Windows Platform). Earlier this week Microsoft held a [6]virtual conference to update developers on what is happening with Xamarin.
The first thing to note is that Xamarin Forms (versus designing a native GUI separately for each platform) now seems to dominate ? judging by its high profile in the virtual conference. In a well-received session, developer Steven Thewissen spoke about "building beautiful apps", observing that "Xamarin Forms has a bit of an image problem" thanks to its initial launch as something for simple data entry applications. The name is now a misnomer, he suggested. Thewissen explained how to use gradients, shadows and typography with Xamarin Forms, using either libraries like [7]SkiaSharp , based on Google's Skia Graphics library, or the Xamarin Forms gradients API, which he said is "coming soon". Using Forms is best for cross-platform apps, he added, since other approaches cost "way more".
Another prominent topic was [8]Xamarin Shell , a simplified XAML framework that lets you create a bare-bones application declaratively, to which you can add rich content as needed. Using Shell can improve performance as well as speeding development by providing essentials like flyouts, tabs and navigation. Dual-screen support is coming soon.
[9]
Xamarin Shell is a bare-bones, high-performance framework for the 'shell' of an application
Productivity is also improved by using [10]Xamarin Essentials , which provides a cross-platform API to access hardware and operating system features such as the clipboard, file operations, accelerometer, network, geolocation, launching other applications, sending SMS messages, or even converting text to speech. Version 1.5, just released, adds OAuth authentication. Version 1.6, in preparation, will add macOS support (currently it is just Android, iOS and UWP), as well as file pickers and access to contacts and calendars.
Rodney Littles II, a senior software engineer in Texas, presented [11]ReactiveUI , for which he is a maintainer. The library is exactly what its name implies: a library that enables reactive programming for a user interface. Using this approach improves code readability as well as helping reusability of code and remaining understandable as applications become more complex, he said.
On the platform support side, support for Apple's Xcode 11.4 is out now and support for Android 11 will come with Visual Studio 2019 16.6 preview 2, we were told (the current preview is 16.6 preview 1). Visual Studio on Windows seems to be ahead of Visual Studio Mac for Android development, though the latter is more convenient for targeting iOS and essential for targeting macOS. [12]AndroidX , the updated Android support libraries also known as Jetpack, are supported in Xamarin and there is an AndroidX migrator in preview which will assist with updating existing applications.
Developing for iOS on Windows has become easier, thanks to a feature called [13]Xamarin Hot Restart now in preview. This only works with Xamarin Forms apps for iOS. It lets you debug your app on a connected iOS device, with the ability to make changes to the code and push them to the device without a full rebuild and deploy. The effect is that you can test and debug with just Windows and a device, rather than needing to use a connected Mac.
If .NET Core realises the goal of .NET on any platform for web and server applications then Xamarin does nearly the same for client applications. There are a few snags. On Windows, Xamarin can target UWP but not traditional Win32 applications, though there is [14]preview support for WPF . There is also uncertainty over Xamarin Forms support for WinUI, which is in Microsoft's current thinking the future for Windows development. A [15]GitHub issue on the topic is marked as "under consideration".
Xamarin: Design an app for Windows, iOS and Android ... from one codebase? [16]READ MORE
The fact that Xamarin is cross-platform is, as ever, a mixed benefit. If you only want to target one platform, it is unlikely to be the best technology to use. Even if you are doing cross-platform, enthusiasm for Xamarin within Microsoft seems to vary, with the Windows team as likely to point you towards web technology or React Native. Cross-platform adds complexity, and Xamarin technology has at least its fair share of issues.
[17]
Developing for iOS and Android with Visual Studio for Mac 8.5
It is also worth noting, however, that Xamarin is now well established as a viable cross-platform solution and one that has been kept up to date with changes in iOS and Android, its primary targets. The Microsoft acquisition has paid off, with more code shared between Xamarin and .NET Core, and improved tooling in Visual Studio on both Windows and Mac (Visual Studio for Mac 8.5 has been [18]just released ). The platform is greatly improved from its early days, particularly with the success of Xamarin Forms in providing a viable cross-platform GUI framework. ?
[1] https://www.theregister.co.uk/2020/02/13/designing_windows_and_android_apps_for_dualscreen_devices/
[2] https://tirania.org/blog/archive/2009/Sep-14.html
[3] https://tirania.org/blog/archive/2011/Jan-04.html
[4] https://www.theregister.co.uk/2016/02/25/microsoft_acquires_xamarin/
[5] https://www.theregister.co.uk/2014/05/30/xamarin_three/
[6] https://focus.dotnetconf.net/
[7] https://github.com/mono/SkiaSharp
[8] https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/shell/
[9] https://regmedia.co.uk/2020/03/25/shell.jpg
[10] https://docs.microsoft.com/en-us/xamarin/essentials/
[11] https://reactiveui.net/
[12] https://developer.android.com/jetpack/androidx/
[13] https://docs.microsoft.com/en-us/xamarin/xamarin-forms/deploy-test/hot-restart
[14] https://docs.microsoft.com/en-us/xamarin/xamarin-forms/platform/other/wpf
[15] https://github.com/xamarin/Xamarin.Forms/issues/8510
[16] https://www.theregister.co.uk/2014/05/30/xamarin_three/
[17] https://regmedia.co.uk/2020/03/25/vsmac.jpg
[18] https://devblogs.microsoft.com/visualstudio/visual-studio-2019-for-mac-version-8-5-is-now-available/
As someone who had to Xamarin Forms development a few years ago all I can really say is, "stay the fuck away". Worst year of my life.That thing is so buggy and so slow! Not to mention the size of even the simplest application is ridiculous, you're talking easily 50MB and often more.
It's been improving steadily. I suspect from your description that you actually it used it over two years ago. That's when I started using it and I agree that it was a pain. The tooling was chronic - ten minutes for a build and sometimes the build just hung or failed for no reason.
But since about summer last year it's become not a lot worse than Wpf development. Having to build on a Mac is still a pain and some debugger features aren't implemented or can be a bit fickle but it's nothing an experienced software developer should be shocked about.
I'd say that any Wpf development team considering a cross-platform product would be well advised to look at Xamarin. We support WPF, Android and iOS and 95% of our code is shared between projects. The only thing we have to do for the mobile versions is a bit of UI tweaking and occasionally inject platform specific services.
AndrueC, it's experiences such as yours that are very intriguing for somone who has yet to dip their toes into mobile app development, but may soon have to. It sounds (and not just from your post, I've quite a lot of encouraging stuff elsewhere too) that MS / Xamarin / .NET Core / etc might just be evoloving into the ecosystem to use, even if it is a bit rough still.
It would also be a right turn up for the books if MS ended up accidentally having a stranglehold on mobile app development, by having control of the one cross-platform technology that actually does it well enough for most purposes. All it takes is for a majority of developers to move to MS's tools, et voila. The question then is what would Google and Apple pay MS to ensure that their phones are well supported by MS's tools? And if this did happen, i) it'd be a massive miss by Oracle / JAVA, ii) that'd teach Google and Apple not to build walled gardens.
The only thing that worries me about this is that, with control over all the libraries, etc. that everyone would then be using for all mobile development, would MS take the opportunity to slurp a load of data by loading those libraries with lots of "additional" functionality? Afterall, if most mobile apps ended up being written using MS technology, and run on either iOS or Android, that'd give MS more slurping power than either Google or Apple. Is there any hint yet in Xamarin of this kind of thing going on? I hope not...
As someone who's worked with xamarin forms for nearly 3 years now, I am thrilled that it's actually becoming more usable. Anyone who had the displeasure of using XF in 2017 will remember how much of an absolute nightmare it was.
Although I appreciate everything getting better, my application which I started in mid 2017 still works, but recent updates to VS break the tooling because of how the projects used to be set up. I fear that I'll have to completely rebuild the application.
Probably not a bad thing. XF apps used to require some horrific hacks for fairly basic functionality.
"Dual-screen support is coming soon"
It is extremely telling that such a phrase seems totally normal these days.
Dual screens. We've spent over four decades using IT stuff more and more because prices have, globally, always been falling. For what seems like forever I've only used one screen per computer, like everybody else. But, since between five and ten years, I've been seeing more and more developers use two screens at work, and I've personally been on two screens at home for nine years now. About a third of my career.
I know some people who have three screens. My graphics card has four ports for connecting screens. It is currently managing exactly 10 512 000 pixels.
Technology is awesome.