skip to Main Content

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.

3

Answers


  1. 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.

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

    Are you looking for REPL? If so, you might be looking for Swift Playground. Xcode also has it’s own playground system, but I’m having trouble finding good supporting documentations.

    Login or Signup to reply.
  3. To your question of processing normal logic and not just a preview of the UI components, as of today Apple does not provide that feature however there is an open source project that seeks to accomplish what you’re looking for:

    https://github.com/krzysztofzablocki/Inject

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search