1

How would I run swift build for a specific device, e.g. iPhone 12, or specific OS, e.g. iOS12? I also can't find any docs for the swift CLI. swift build --help doesn't help me enough. I don't want to build for macOS, but I keep getting the error:

error: the library 'library_name' requires macos 10.10`, but depends on the product 'library_name_2' which requires macos 10.12; consider changing the library 'library_name' to require macos 10.12 or later, or the product 'library_name_2' to require macos 10.10 or earlier.

I don't have an Xcode project, I am using a Swift Package.

I did notice swift build --build-system, swift build --toolchain, swift build --sdk, but there are no more information about, and which options I can use.

Ben Butterworth
  • 22,056
  • 10
  • 114
  • 167
  • In addition to the information in the duplicate, you would typically build using the latest SDK and if you wanted compatibility with earlier versions of iOS just avoid using features that aren't available in that version (or guard them with `if available`). To actually build using a particular, older, SDK you would need to install and select that earlier toolchain – Paulw11 Jun 17 '21 at 21:57
  • It's actually not a duplicate. The real answer to the question, it seems is, `swift build` **can't** do that. I'm not asking how to build a Swift package (and I did build it with `xcodebuild`, I am asking how to use `swift build` to build the package. The point being, I want to learn how to use `swift build`. Oh but the second answer seems to help (though it uses `xcrun`...) – Ben Butterworth Jun 17 '21 at 22:09

0 Answers0