{"id":13710795,"url":"https://github.com/AndreiMisiukevich/HotReload","last_synced_at":"2025-05-06T19:32:44.716Z","repository":{"id":60773194,"uuid":"156032875","full_name":"AndreiMisiukevich/HotReload","owner":"AndreiMisiukevich","description":"Xamarin.Forms XAML hot reload, live reload, live xaml","archived":false,"fork":false,"pushed_at":"2023-02-21T06:16:32.000Z","size":27905,"stargazers_count":414,"open_issues_count":0,"forks_count":40,"subscribers_count":26,"default_branch":"master","last_synced_at":"2025-04-08T10:32:12.698Z","etag":null,"topics":["hacktoberfest","hot-reloads","hotreload","hotreloading","livereload","livexaml","xamarin","xamarin-forms"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AndreiMisiukevich.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-03T23:33:10.000Z","updated_at":"2025-03-20T03:31:23.000Z","dependencies_parsed_at":"2024-06-18T22:59:33.514Z","dependency_job_id":"5db1b26c-5be5-47ea-b8fa-04e1103097cc","html_url":"https://github.com/AndreiMisiukevich/HotReload","commit_stats":{"total_commits":281,"total_committers":17,"mean_commits":"16.529411764705884","dds":"0.17437722419928825","last_synced_commit":"cb67e4af116c2b3ea159072f120dfc5eb4600b34"},"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndreiMisiukevich%2FHotReload","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndreiMisiukevich%2FHotReload/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndreiMisiukevich%2FHotReload/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndreiMisiukevich%2FHotReload/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AndreiMisiukevich","download_url":"https://codeload.github.com/AndreiMisiukevich/HotReload/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252753741,"owners_count":21799003,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","hot-reloads","hotreload","hotreloading","livereload","livexaml","xamarin","xamarin-forms"],"created_at":"2024-08-02T23:01:00.952Z","updated_at":"2025-05-06T19:32:39.696Z","avatar_url":"https://github.com/AndreiMisiukevich.png","language":"C#","funding_links":[],"categories":["Tools"],"sub_categories":[],"readme":"![logo](https://github.com/AndreiMisiukevich/HotReload/blob/master/logo/hotreload-logodesign-colored.png)\n\n# HotReload\n[![Twitter URL](https://img.shields.io/twitter/url/https/github.com/Andrik_Just4Fun/notification-feed.svg?style=social)](https://twitter.com/intent/tweet?url=https%3A%2F%2Fgithub.com%2FAndreiMisiukevich%2FHotReload\u0026text=%23XamarinForms%20%23HotReload%0A%0AXamarin.Forms%20XAML%2FCSS%20hot%20reload%20%2F%20live%20reload)\n Xamarin.Forms XAML/CSS hot reload / live reload [![Build status](https://dev.azure.com/andreimisiukevich/HotReload/_apis/build/status/HotReload-.NET%20Desktop-CI)](https://dev.azure.com/andreimisiukevich/HotReload/_build/latest?definitionId=2)\nSample Video you can find here: https://twitter.com/i/status/1124314311151607809\n\n![Sample GIF](https://github.com/AndreiMisiukevich/HotReload/blob/master/files/gf1.gif?raw=true)\n\n# Setup\n\n## Extension\n\n### Visual Studio for **MAC**\n\n* Visual Studio for Mac extension is available for downloading here http://addins.monodevelop.com/Project/Index/376 \nOr by searching in Visual Studio's extension manager\n![alt text](https://github.com/AndreiMisiukevich/HotReload/blob/master/files/mac_extension_manager.png)\n* Header of \"HotReload for Xamarin.Forms\" extension will appear in Visual Studio's \"Tools\" dropdown menu.\n \"Enable extension\" menu item will appear as soon as solution is opened.\n ![alt text](https://github.com/AndreiMisiukevich/HotReload/blob/master/files/mac_extension_menu.png)\n\nNOTE: Restart Visual Studio after installation (in case of menu didn't appear in toolbar).\n\n### Visual Studio for **WINDOWS**\n\n* You may use official HotReload's Visual Studio Extension https://marketplace.visualstudio.com/items?itemName=StanislavBavtovich.hotreloadxamarinforms. Also can be downloaded via extension manager \n ![alt text](https://github.com/AndreiMisiukevich/HotReload/blob/master/files/win_extension_manager.png)\n \nNOTE: Restart Visual Studio after installation.\n* To make \"HotReload for Xamarin.Forms\" extension's toolbar visible turn it on in \"Tools/Customize\" window.\n ![alt text](https://github.com/AndreiMisiukevich/HotReload/blob/master/files/win_extension_enable.png)\n * As soon as solution is opened \"Enable extension\" button will appear on \"Tabs panel\".\n ![alt text](https://github.com/AndreiMisiukevich/HotReload/blob/master/files/win_extension_tab.png)\n \n### JetBrains **Rider**\n\n* In case if you use JetBrains Rider IDE you can download official HotReload's Rider plugin via setting menu (File -\u003e Settings -\u003e Plugins (pick \"Marketplace\" tab) -\u003e search by \"HotReload\".\n![alt text](https://github.com/AndreiMisiukevich/HotReload/blob/master/files/rider_extension_manager.png)\nAll previous versions are available via link: https://plugins.jetbrains.com/plugin/12534-hot-reload\n* After Rider restart \"Enable extension\" button will appear on Navigation Bar.\n![alt text](https://github.com/AndreiMisiukevich/HotReload/blob/master/files/rider_extension_tab.png)\n\n### Other IDE/TextEditors (eg. NotePad++ | Sublime | VS Code etc.)\n\n* Build observer project yourself (Release mode) and find **exe** file in bin/release folder https://github.com/AndreiMisiukevich/HotReload/tree/master/Observer/Xamarin.Forms.HotReload.Observer and put it in the root folder of your Xamarin.Forms NETSTANDARD/PCL project.\n* Start Xamarin.Forms.HotReload.Observer.exe via terminal (for MAC) ```mono Xamarin.Forms.HotReload.Observer.exe``` or via command line (Windows) ```Xamarin.Forms.HotReload.Observer.exe``` etc.\n* Optionaly you can set specific folder for observing files (if you didn't put observer.exe to the root folder) and specific device url for sending changes.\n```mono Xamarin.Forms.HotReload.Observer.exe p=/Users/yourUser/SpecificFolder/ u=http://192.168.0.3```\n\n## Reloader\n\n### Base Setup\n\n* Available on NuGet: [Xamarin.HotReload](http://www.nuget.org/packages/Xamarin.HotReload) [![NuGet](https://img.shields.io/nuget/v/Xamarin.HotReload.svg?label=NuGet)](https://www.nuget.org/packages/Xamarin.HotReload)\n* Add nuget package to your Xamarin.Forms **NETSTANDARD**/**PCL** project and to all platform-specific projects **iOS**, **Android** etc. just in case (but adding to portable project should be enough)\n* Setup Reloader\n```csharp\nusing Xamarin.Forms;\n\nnamespace YourNamespace\n{\n    public partial class App : Application\n    {\n        public App()\n        {\n            InitializeComponent();\n#if DEBUG\n            HotReloader.Current.Run(this); \n#endif\n            MainPage = new NavigationPage(new MainPage());\n        }\n    }\n}\n```\n**IMPORTANT:** i suggest to NOT use ```[Xaml.XamlCompilation(Xaml.XamlCompilationOptions.Compile)]``` with HotReload. It can cause errors. So, don't enable it for Debug or disable.\n\n### C# Elements reloading\n* **AVAILABLE ON ANDROID AND IOS SIMULATORS**.\n\n* First of All add ```--enable-repl``` to iOS additional mtouch arguments for iPhone Simulator:\n\n![alt text](https://github.com/AndreiMisiukevich/HotReload/blob/master/files/enable_repl.png)\n\n**NOTE**: BindingContext will be copied automaticaly, but if your view constructor has any parameters, you will have to define a property **object[] HotReloadCtorParams =\u003e new object[] { }**:\n```csharp\n[HotReloader.CSharpVisual]\npublic class CodeContentPage : ContentPage\n{\n    private Color _backColor;\n\n    public CodeContentPage(Color backColor)\n    {\n        _backColor = backColor;\n        BackgroundColor = backColor;\n    }\n\n    object[] HotReloadCtorParams =\u003e new object[] { _backColor }; //These arguments will be passed in case of reloading\n}\n```\n\n* ViewModels (BindingContext) can be updated as well. No need to to mark them with any attribute.\n\n### Additional Setup / Troubleshooting\n\n1) If you want to disable HotReload for Release mode, follow instructions here https://github.com/AndreiMisiukevich/HotReload/issues/115#issuecomment-524545788\n\n2) Your device/simulator/emulator will be discovered automatically. (**IMPORTANT**: \nMake sure your PC/Mac and device/emulator are in the same local network.)\n\n3) If your device and PC/Laptop are in different subnets (or extension doesn't discover device), you should specify your Extension's IP during reloader setup\n\n```csharp\nHotReloader.Current.Run(this, new HotReloader.Configuration\n{\n    //optionaly you may specify EXTENSION's IP (ExtensionIpAddress) \n    //in case your PC/laptop and device are in different subnets\n    //e.g. Laptop - 10.10.102.16 AND Device - 10.10.9.12\n    ExtensionIpAddress = IPAddress.Parse(\"10.10.102.16\") // use your PC/Laptop IP\n});\n```\n\n4) Android Emulator IP autodiscovery:\n**Windows:** Make sure that **adb** (usually located in C:\\Program Files (x86)\\Android\\android-sdk\\platform-tools) is added to PATH enviromnet variable in other case you will have to forward ports yourself. It it isn't added. Add it then restart visual studio or Rider\n\n**BY DEFAULT EXTENSION TRIES TO FORWARD PORTS ITSELF (and you should skip this step) BUT** in case it is not working you should forward the port yourself (here is example with **DEVICE** port 8000 (*DeviceUrlPort* default value).\n\n```\nadb forward tcp:8000 tcp:8000\n```\n\n**keep in mind** that HotReload may change your DEVICE's port (it's edge case and shouldn't happen, but just keep in mind that it's possible).\nSo if *adb forward* doesn't help, open **APPLICATION OUTPUT** and look for ```$\"### HOTRELOAD STARTED ON DEVICE's PORT: {devicePort} ###\"```\nAnd execute *adb forward*  with that value. Also you can get selected port and device IP's there:\n\n```csharp\nvar info = HotReloader.Current.Run();\nvar port = info.SelectedDevicePort;\nvar addresses = info.IPAddresses;\n```\n\n5) If you want to make any initialization of your element after reloading, you should define a method **void OnHotReloaded ()**. It will be called each time when element's content (xaml/code) updated.\n\n```csharp\npublic partial class MainPage : ContentPage\n{\n    public MainPage()\n    {\n        InitializeComponent();\n    }\n\n    void OnHotReloaded() // Add logic here\n    {\n        label.Text = \"I'm loaded again\";\n    }\n}\n```\n\n6) **ViewCell** reloading: before starting app you **MUST** determine type of root view (e.g. StackLayout). It cannot be changed during app work (I mean, you still can change StackLayout props (e.g. BackgroundColor etc.), but you CANNOT change StackLayout to AbsoluteLayout e.g.). \n\n```xaml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003cViewCell xmlns=\"http://xamarin.com/schemas/2014/forms\" \n          x:Class=\"Xamarin.Forms.HotReload.Sample.Pages.Cells.ItemCell\"\u003e\n    \u003cStackLayout\u003e\n    \u003c/StackLayout\u003e\n\u003c/ViewCell\u003e\n```\n\n7) **Previewer** properties: if you want to use ```xmlns:d=\"http://xamarin.com/schemas/2014/forms/design\"``` during your work with HotReload, you can achieve it by two approaches\n- Global setting. Manage previewer propertis use via **Configuration**. Design properties will be used by default unless you disable them via Xaml.\n\n```csharp\nHotReloader.Current.Run(this, new HotReloader.Configuration\n{\n    PreviewerDefaultMode = HotReloader.PreviewerMode.On\n});\n```\n\n- Local setting. Manage previewer propertis use via **XAML**. You can override default behavior for particular file with following markup:\n\n```xaml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003c?hotReload preview.on?\u003e\n\u003cContentPage\u003e\n...\n\u003c/ContentPage\u003e\n```\n\nUse ```\u003c?hotReload preview.on?\u003e``` to allow design properties and ```\u003c?hotReload preview.off?\u003e``` to forbid them.\n\n# Old Extensions (with mannual IP entering)\nIf you wish to enter device's IP mannualy, you may use these extensions (Make sure you disabled extensions autoupdate)\nhttps://github.com/AndreiMisiukevich/HotReload/tree/master/old_extension_packages\n\n# INFO\n\n## Collaborators\n- [AndreiMisiukevich (Andrei)](https://github.com/AndreiMisiukevich) [![Twitter URL](https://img.shields.io/twitter/url/https/twitter.com/Andrik_Just4Fun.svg?style=social\u0026label=Follow%20%40Andrik_Just4Fun)](https://twitter.com/Andrik_Just4Fun)\n- [stanbav (Stanislav)](https://github.com/stanbav) [![Twitter URL](https://img.shields.io/twitter/url/https/twitter.com/stasbavtovich.svg?style=social\u0026label=Follow%20%40stasbavtovich)](https://twitter.com/stasbavtovich)\n- [iBavtovich (Ignat)](https://github.com/iBavtovich) [![Twitter URL](https://img.shields.io/twitter/url/https/twitter.com/iBavtovich.svg?style=social\u0026label=Follow%20%40iBavtovich)](https://twitter.com/iBavtovich)\n\nAre there any questions? ***just ask us =)***\n\n## License\nThe MIT License (MIT) see [License file](LICENSE)\n\n## Contribution\nFeel free to create issues and PRs 😃\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAndreiMisiukevich%2FHotReload","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAndreiMisiukevich%2FHotReload","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAndreiMisiukevich%2FHotReload/lists"}