Xcode 14 RC No Such Module error with SwiftPM

Hi fellow devs,

I updated Xcode to version 14 last week and I wanted to get our app ready for working on Xcode 14. As it turns out, Xcode 14 gives me an error when trying to test our regular scheme which is working fine on Xcode 13.x.

I'm getting No Such Module 'ModuleX' even thought I am importing the module in the Package.swift file. It looks like this:

let package = Package(
    name: "App",
    defaultLocalization: "en",
    platforms: [.iOS(.v13), .macOS(.v10_14)],
    products: [
        .library(name: "DesignSystem", targets: ["DesignSystem"]),
    ],
    dependencies: [
        .package(url: "git@ssh.blablabla/components-ios", from: "2.0.0")
    ],
    targets: [
     .target(
            name: "DesignSystem",
            dependencies: [
                .product(name: "ModuleX", package: "components-ios")
            ]
      )
]
)

I removed a ton of other packages here and renamed some modules because of the example. Other targets have DesignSystem as a dependency and that compiles just fine. I'm just getting very confused about what's going on.

A regular build and run on simulator compiles, but when I'm testing the scheme, he cannot seem to locate this specific Module.
I'm using swift tools version 5.6.

Do you have any advice?

Thanks in advance.

Regards,

Frank.

1 Like

Hey Frank,

I just upgraded to Xcode 14 today and ran into this issue when archiving a build. I just found a solution for myself, but it's not preferable. I changed all my deployment targets to 16.0 and was able to upload to TestFlight (I had added a few checks for iOS 16, but may need to re-think those).

Hopefully this can help you, but I'll be exploring other options and will share my findings/keep an eye on this thread.

-Joey

1 Like

Hey Joey thanks for the reply,

We need to support at least iOS 13 - iOS 16 so just changing to 16 won't be a solution for us unfortunately.

Same. I will share any findings here.

Have a nice weekend!

Frank

Just quickly tried setting all deployment targets to iOS 16.0 but that does not help me unfortunately.

@FrankSolleveld were you able to solve this? I'm seeing the same problem with my project, No Such Module 'ModuleX' when moving to XCode14. Everything works fine on XCode 13.x

@FrankSolleveld, you might want to check consistency of Build Configurations between your Test Build Scheme and schemes of targets that Test Target depend on.

Ran into the same issue and spent inappropriate amount of willpower to resolve it.

Any update on this? I have the same issue.

I came across this issue to and SwiftPM wasn't able to resolve any packages correctly. My project was initially in xcode 13.4 and I migrated over to xcode 14.3 and the missing modules all started. The only way I could get around this issue was to start an entirely new project and copy stuff over manually. After I did this SwiftPM resolved everything correctly and I could build my App again.