Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

181
Views
Module not found using Swift Package Manager building app target

I'm using Swift Package Manager to modularize a large mixed Objective-C and Swift iOS app. The app also uses CocoaPods for a few dependencies for which there is no Swift Package.

My project structure is as follows:

ios/
  MyApp/
    ...
    CorePackage/
       Sources/
          Core/ ...Swift stuff goes here
          CoreObjC/ ... Obj-C stuff goes here

I have created the following Package.swift for my CorePackage. Note that I'm trying to use a Swift Language Swift Package in an Objective-C Language Swift Package:

let package = Package(
    name: "CorePackage",
    products: [
        .library(name: "Core", targets: ["Core", "CoreObjC"]),
    ],
    dependencies: [ ... ],
    targets: [
        .target(
            name: "Core",
            dependencies: [ ... ],
            path: "Sources/Core"
        ),
        .target(
            name: "CoreObjC",
            dependencies: [ "Core", ... ],
            path: "Sources/CoreObjC",
            publicHeadersPath: "include"
        )
    ]
)

The following build command succeeds when run in the MyApp/CorePackage directory:

> xcodebuild -scheme "Core" -sdk iphonesimulator  -destination 'platform=iOS Simulator,name=iPhone 13' build

I have added the "Core" package to my Frameworks, Libraries and Embedded Content target General Settings.

Now, when I try to build the app target from the ios directory:

> xcodebuild -scheme "MyApp" -sdk iphonesimulator  -destination 'platform=iOS Simulator,name=iPhone 13' -workspace MyApp.xcworkspace build

I get the following error:

/.../ios/MyApp/CorePackage/Sources/CoreObjC/include/HeaderA.h:13:9: error: module 'Core' not found
@import Core;

...

/.../ios/MyApp/HeaderB.h:11:9: note: while building module 'CoreObjC' imported from /.../ios/MyApp/HeaderB.h:11:
@import CoreObjC;

I have had no trouble when using packages with a single target, either Objective-C or Swift. Does anyone know what I'm missing here? So far I've lost a whole day trying to figure it out.

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!