I am trying to create an archive of my Xcode 11 project, but it keeps failing. The project uses two libraries that are imported via SwiftPM directly from Xcode. Building and Running the project on my physical device and the simulator works fine.
When I archive the project I get compiler errors for one of my libraries saying, that he didn't found the SwiftUI keywords (Use of undeclared type Binding
, ...). For the second library, he just says, that compiling failed with a nonzero exit code. I have uploaded the archive log.
Is there anything special I have to do while archiving projects with SPM? Any build settings I have to change?
I am running iOS 13.1.2 on my iPhone that was selected during archiving. My deployment target is iOS 13.0 and my Macbook is running macOS Mojave 10.14.6 with Xcode 11.0.
I have already tried deleting the DerivedData folder and re-fetching the libraries from their GitHub.
After trying around a bit more, I found out that the project didn't compile when using the Release configuration (rather than just while archiving).
The problem with my project was my Swift library. It seems, that a SwiftPM library that uses SwiftUI needs the following part in it's Package.swift
platforms: [
.iOS(.v13),
.macOS(.v10_15),
.tvOS(.v13)
],
to indicate, that it requires a minimum of iOS 13, macOS 10.15 or tvOS 13.
After adding the section to my Swift library, the project compiled into an archive without any problems.