johnno1962 / InjectionIII

Re-write of Injection for Xcode in (mostly) Swift
MIT License
4.01k stars 319 forks source link

Not working in Xcode 16 #520

Open schwjustin opened 2 days ago

schwjustin commented 2 days ago

I have a SwiftUI project and injection works as expected in xcode 15.2 with the app running in a simulator. However, in xcode 16 I get the 💉 Injected type # logs but the app doesn't actually update.

I tried deleting derived data, clean build folder, rebuild, double checked I have -Xlinker and -interposable, and double checked I'm running the debug scheme.

johnno1962 commented 2 days ago

What version of the app are you using? Github Releases 5.0.1 and above include the change required for Xcode 16. https://github.com/johnno1962/InjectionIII/releases

nwywn commented 1 day ago

I had the App Store version which was last updated 11mo ago. I installed latest version from Github and it's working now.

schwjustin commented 18 hours ago

I had the app store version and tried the latest from github and it still doesn't work

schwjustin commented 17 hours ago

Actually it's working on some views but on others that have @ObserveInjection var forceRedraw and .enableInjection() the app crashes. For example, I just tried to change the string in a Text("") and it crashed. In other views I'm able to make this change and it will live reload.

johnno1962 commented 7 hours ago

You're saying things that were previously reliable with 15.2 now occasionally work and sometimes crash with Xcode 16. That seems unlikely. Are you sure that you've added .enableInjection() at every level of views you are trying to inject? You can't just add it at the top level. If you're obeying all the rules outlined in the https://github.com/johnno1962/HotSwiftUI project and you're still seeing problems I'd be interested to investigate further. Previously, this has been very reliable.