Closed crash481 closed 1 year ago
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!
So InjectionIII is for Code Injection to working binary and it calls injected()
methods, and I need to reload injected classes
But for what is HotReloading repository/project is done? Because I cannot run, but when reading code it is something like "Inject" project, no?
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.
Oh, understood. So Hot reloading also needs to implement Injection callbacks. Do you have own solution to have hot reloading without minimum code changes for UIKit projects? Or Inject lib is the best for it?
I just want to write code like a Flutter hot reloading, but with UI Kit. And that my team also used it for faster UI development Can you advice the best Hot Reloading guide in my case?
And also one more question: What is Standalone Injection and is it better for my case?
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! Thank you very much for such great technology!
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: 1) Installed last version of https://github.com/johnno1962/InjectionIII in /Applications directory 2) launch the InjectionIII app and select "Open project" with the root of my project 3) Add flags "-Xlinker -interposable" to all targets 4) Add swift package with "https://github.com/johnno1962/HotReloading" (only first)
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 errorWhat 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 1) 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)2) 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