iosxcodexcodebuildswift-package-manager

Building Swift Package Manager project with xcodebuild, how to ignore xcodeproj and xcworkspace?


I have an SPM project that I need to test with xcodebuild (because it has iOS resources such as XIBs). This project also supports Cocoapods so it also has .xcodeproj and .xcworkspace files.

Normally xcodebuild will automatically detect the Package.swift file and use that to build, but now it detects the Cocoapods workspace and tries to go from that instead.

I read through the documentation for xcodebuild, but couldn't find a flag to explicitly point it to the Package.swift.

Is there any equivalent to the --project or --workspace flag that I can use to tell xcodebuild to use the Package.swift file and ignore the project and workspace?


Solution

  • To use xcodebuild with Swift Package Manager, you specify the scheme name: xcodebuild -scheme [SchemeName].

    If there is a conflict with Cocoapods, I suggest you change the scheme names to be unique.