-
-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hot reloading not changing my views #78
Comments
Please read the notes in the InjectionIII project about how you need to alter your code (@objc fun injected() methods or injectionObserver for SwiftUI) if you expect to be able to see your views redraw automatically on injection. The code you have injected needs to be re-executed for you to see the view change on the screen. If you've found the Inject project works you should use that. |
Thank you for quick answer! But for what is HotReloading repository/project is done? |
The HotReloading project is basically all the code for the InjectionIII app and it's bundles as a Swift package which is used as a sub-repo when you build the app itself. It's normally used when you want to inject on an actual device rather than the simulator as you can't load one of the pre-built bundles inside the InjectionIII app on your Mac file system on a device. It can also be used in the simulator instead of the injectionIII app but that's another story. Once you've found a configuration that works and you feel you understand stick to that. There are many (perhaps too many) variations to using Injection. |
HotReloading is the same code so yes it needs some code modifications like the InjectionIII bundles. There are two separate problems: First, you need to inject the new code into your app and Injection looks after that. The second is that the new code needs to be called again so you see the changes take effect on the screen. It would be nice if that were automated and Inject package is a step further down that road so perhaps that is the best fit for you. Standalone injection is using the HotReloading package or the bundles but without the app running which also works. |
Oh, thanks a lot, so I will go with Inject project and will try to use it in my next development cycle! It will be great if there no any code changes needs for UI reloading like in Flutter apps, but maybe it is not possible to make less changes that in Inject project |
Hello, thank you a lot for your work, it is amazing!
Help me please to setup your built with HotReloading, because it is not working for me
So my steps is below:
5) Run project
But after launch Mac status bar Injection app do not change color from blue to orange.
In terminal I see only
"HotReloading available for sources under ["projectPath"]"
But when I modify and save some file I see error
What is wrong? My Xcode is 14.3. Project is a Swift UIKit
Also I tried to move project from /Documents directory, but it is not fixing
Whole Module Optimisation is disabled by default (I building debug for simulator)
Also I tried to make with another ways
instead of steps 4,5 I add
Bundle(path: "/Applications/InjectionIII.app/Contents/Resources/iOSInjection.bundle")?.load()
and after this it is texts in console about injections without errors. But there is no any changes in View
As I understand injection is success, but view is not reloaded and I need to do it with my code (it is not convenient)
instead steps 4,5 I used this add-on library https://github.com/krzysztofzablocki/Inject
And it is works. As I understand his code clearly - he just reloading views after success injections
Am I right, that your "HotReloading" also made for updates view in simulator without any code updates?
Because if true, the it is better for me to use your implementation as a main developer of this great technology. You will change how I will write my code
Also in krzysztofzablocki/Inject i also need to change some code for UI become changing in simulator, but in your [HotReloading] guide I do not need change any code
The text was updated successfully, but these errors were encountered: