krzysztofzablocki / Inject

Hot Reloading for Swift applications!
MIT License
2.1k stars 114 forks source link

Device injection #63

Closed icedice closed 1 year ago

icedice commented 1 year ago

I just realised that i was commenting on a closed issue so I deleted my comment and created this instead.

I am wondering about device injection. I realise that injection on the device is very experimental but it is also extremely cool and useful so I really want to get it working. For me what is happening is that it never connects, in fact nothing is outputtet to the console at all.

I did mange to get device injection to work using the HotReloading project, but I prefer this way for ease of use and because I'm having issues with hot refreshing collectionView cells with the HotReloading project which seems to work out of the box using this. It was my understanding that this project and the HotReloading project connects to the InjectionIII app the same way which is way I'm confused why device reloading works with HotReloading but not with Inject....

johnno1962 commented 1 year ago

Hi, The HotReloading project is effectively a Swift Package of the contents of the iOSInjection.bundle on the file system that Inject would normally load. As this is not available on the device you use HotReloading instead to compile it into your app.

icedice commented 1 year ago

Oh ok. Thank you for the clarification, I guess I should see if I can somehow merge the device reloading from the hotreload project with the convenience of this project...

johnno1962 commented 1 year ago

You should be able to use Inject with HotReloading as readily as you can with using the bundle. Let me know if you can't!

icedice commented 1 year ago

Cool. I will try this tomorrow. Will let you know. I dont need to remove the code that loads the bundle from the inject code?

johnno1962 commented 1 year ago

No, it tests to see if HotReloading is already present: https://github.com/krzysztofzablocki/Inject/blob/main/Sources/Inject/Inject.swift#L33

icedice commented 1 year ago

Just testet it out, it does seem to refresh but changes to collection view cells does not seem to update and changes to the collectionview it self causes a completely black screen. Not sure whats going on here.

johnno1962 commented 1 year ago

Hi, it sounds like you're trying to do something quite ambitious. Try it in the simulator first before you venture into device injection. "injection on the device is very experimental"

icedice commented 1 year ago

You are right. It might be a bit to ambitious. I will stick with the simulator for now which seems to be working very well.