Search code examples
iosswiftswiftuihot-reload

Is there Hot Reload with Swift


Im researching Swift features and have the Question if there is a Hot Reload Feature or something similar like "instant run".

https://developer.apple.com/xcode/swiftui/ On this Page they say:

"Xcode includes intuitive design tools that make building interfaces with SwiftUI as easy as dragging and dropping. As you work in the design canvas, everything you edit is completely in sync with the code in the adjoining editor. Code is instantly visible as a preview as you type, and any change you make to that preview immediately appears in your code. Xcode recompiles your changes instantly and inserts them into a running version of your app — visible, and editable at all times."

My question to that is if this is only true for UI-Development with Swift but doesnt work with thie normal Logic.


Solution

  • It's only a feature of Previews, but if you select the "run" button in the preview toolbar, it will run a lot of arbitrary code in ways that are very similar to hot reloading.