MobileXamarin

Hot Reload in Xamarin

By 8 June 2020 No Comments

Hot Reload in Xamarin

How to Enable XAML Hot Reload for Xamarin Forms

Sharing is caring!

Designing the UI was never too friendly in Visual Studio while you are working on Xamarin apps. It works a bit under MacOS but in Windows it isn’t too friendly. You have to build the project just to see a small change you made in UI. This is quite time wasting, and frustrating, if the machine you are using is not fast enough to let Visual Studio run smoothly.

Then comes the Hot Reload to rescue. Hot Reload is really helpful to quickly see the changes you are making in your XAML files. No matter if it’s a small change of color, or addition of a whole complex stack layout, your app running in emulator / simulator / or a real device reflect the changes quickly.

The time we had to waste on testing the UI changes reduced to almost none as after using hot reload, we don’t have to keep building the app again. We did rebuild the app again and again, but only to test the functional changes.

Enabling Hot Reload in Visual Studio 2019

You should meet the following requirements to use hot reload in Visual Studio;

Using Visual Studio 2019 16.4 or higher

Or Visual Studio 2019 for Mac 8.3 or higher

Xamarin Forms 4.1 or higher

On Windows:

  1. Go to Options in Tools menu
  2. Select Xamarin from the list at left
  3. Select Hot Reload
  4. Enable the checkbox “Enable XAML Hot Reload for Xamarin.Forms”
  5. Click on OK to apply changes and dismiss the dialog box

You can also locate this setting by searching Hot Reload in Options dialog box.

On Mac:

  1. Click Preferences in Visual Studio menu
  2. Click Xamarin Hot Reload under Projects
  3. Enable the check box Enable Xamarin Hot Reload

Now, you are all set. Just run your app in emulator / simulator or on a physical device. Whatever changes you are making to your UI in XAML, will be immediately updated in your app.

Limitations

Note that there are certain limitations to using hot reload. It can only hot reload your UI changes done through XAML, don’t expect the functional changes to be reflected.

Find out details on limitations at this link;

https://docs.microsoft.com/en-us/xamarin/xamarin-forms/xaml/hot-reload

Conclusion

Hot Reload is time saving feature. Even with its limitations doesn’t matter, because most of a mobile developer’s time spent on designing a great UI which is consistent across an array of devices of varying display sizes. So if functional changes are not loaded using Hot Reload, who cares.

Leave a Reply

Get started with Bloom