A couple of weeks ago Microsoft announced hot reload functionality for Xamarin.Forms.
While this feature isn’t generally available for everyone yet, it’s scheduled to release this fall. It’s also possible to opt-in for a preview version, which can be done here.
Here’s a quote from a blog post announcing the feature:
XAML Hot Reload for Xamarin.Forms speeds up your development and makes it easier to build, experiment, and iterate on your user interface. And this means that you no longer have to rebuild your app each time you tweak your UI – it instantly shows you your changes in your running app!
For those of you already familiar with Xamarin you might know there’s a thing called XAML Previewer which lets you preview the UI created by your XAML markup.
So what’s the deal with this “hot reload” if we can already see our updated UI with the previewer?
Well, they both show you how your UI is looking with your recent changes, but the “hot reload” feature is so much more than the previewer. The previewer is all but an empty shell showing you your UI. The “hot reload” however ties directly into your emulator or device of choice. This means you can interact with your updated UI straight away. This cuts down on time spent inside the “inner development loop”– i.e. the amount of time spent building, deploying, and debugging each change.
There has been a lot of chatter about hot reload these past months, usually mentioning Flutter in the same sentence. Mainly because of the productivity offered by the hot reload built into the framework. I think it’s crucial Microsoft responded to this, helping their developers cut down on development time. And with this announcement, they clearly show their effort of keeping Xamarin one of the leading frameworks to build mobile apps with.
Since the functionality is still in private preview I haven’t had the opportunity to test it out myself, but let’s do a quick rundown of what to expect based on the announcement they made.
- There’s no setup involved in getting this feature working, as it is baked into Visual Studio itself.
- Saving after editing XAML automatically updates the device to reflect changes made.
- It’s important to note that this feature is limited to XAML and Xamarin.FORMS for the time being.
- Built-in resilience against typos and unsupported edits.
- Using the MVVM pattern, UI state bound to your view model will persist through reloads.
These are the features available in today's private preview, but they also shared some items on their roadmap:
- Incremental reloading: Only reload the controls or properties that have been changed.
- Simultaneous reloads: Reload XAML for multiple platforms being debugged at the same time.
- Improved status monitoring: An improved UX for displaying “rude” edits, or edits that contain invalid changes for reload.
- CSS: Styling updates to cascading style sheets will be applied at reload.
So there you have it, Xamarin.Forms users will soon get some sought after productivity gains with the new hot reload. And I for one are excited to get my hands on a preview and test this on a real project when it gets available.
Are you lucky enough to have tested it yet?
As always please share your thoughts and experience in the comments below.