johnno1962 / InjectionNext

Fourth evolution of Code Injection for Xcode
MIT License
76 stars 2 forks source link

Can't inject in complex SPM/XCode project #22

Closed rssole closed 2 months ago

rssole commented 2 months ago

Well, I am trying to set InjectionNext up on my work and basic setup seems to be fine as icon turns orange and I get:

🔥 InjectionNext: iPhoneSimulator connection to app established, waiting for commands. 🔥 Platform connected: iPhoneSimulator

My setup is that this is SPM project and XCode project is below it and 'SomeExternalModule' is SPM dependency specified within Package.swift. I can't really share the project but we can make a Zoom call if you like so I can describe issue.

Anyways, after saving changed file (some SwiftUI view), InjectionNext can't recompile file (looks like references are broken - perhaps due to complexity):

/Users/rastkososkic/iOS/project-dir/Sources/SomeModule/Extensions/Tournament.swift:5:8: error: no such module 'SomeExternalModule' import SomeExternalModule

I have these two in Package.swift among dependencies:

.package(url: "https://github.com/johnno1962/InjectionNext.git", .upToNextMajor(from: "1.0.0")),
 .package(url: "https://github.com/johnno1962/HotSwiftUI.git", .upToNextMajor(from: "1.0.0"))

and like I said, looks like InjectionNext and simulator has connected but compilation fails there although app when built and run from XCode works as expected.

johnno1962 commented 2 months ago

Hi, this might be stretching the boundaries but I have some ideas what it might be. The fastest way to get to the bottom of it however is a Zoom call if you want to send an invite to GitHub @ johnholdsworth.com

rssole commented 2 months ago

Ok suggest time convenient for you please and I will arrange accordingly :)

rssole commented 2 months ago

Ok, I have sent an invitation set to some random time :) just let me know.

johnno1962 commented 2 months ago

Turned out the project had a custom "Derived Data Path" configured which was causing the problems. I'd thought InjectionNext would deal with this case but seemingly not for a large SPM based app project.

rssole commented 2 months ago

Thanks @johnno1962 for your assistance :)