-
-
Notifications
You must be signed in to change notification settings - Fork 9
Hot Reload
S4cha edited this page May 8, 2017
·
2 revisions
No this is not some kind of voodoo magic trick :)
Hot reload works by replacing (also known as swizzling) functions at runtime.
This goes particularly well with react-like solutions that use a render function! That means everything that's within the render
function can we modified at runtime !
Everytime we save the file via Cmd S
or click outside of the Xcode widow, the File watcher will reinject our code, Komponents will detect the injection and re-render the injected component.
This enables us to develop screens super fast, and what you see is what you get \o/
- Download injection for Xcode plugin here
- Install it
- Launch it, you should see a blue icon in the top-right corner of your mac's status bar.
Enabling Hot reload is a piece of cake.
- Open Xcode, Run the app in the simulator.
- Click on the injection plugin and select
Inject Source
- Also enable
File Watcher
so that saving the file triggers injection.
Open the file of the component on screen and modify it, save it and it will rerender :)💉🎉💪