Building static library with Swift package

I tried to build static library this way:

swift build -c release -Xswiftc "-sdk" -Xswiftc "`xcrun --sdk iphoneos --show-sdk-path`" -Xswiftc "-target" -Xswiftc "arm64-apple-ios14.0"

But I can't import any classes from the .a file after linking it to the project. It says "No such module 'myLibNameHere'"

What is the correct way to build library than can be given to customer to link in his iOS project? The main conditions are:

  • customer shouldn't see the sources of my library
  • the library must support real devices (iPhones from iOS 14.0) and simulators

After all. Should I build one more lib (for simulator) with:

swift build -c release -Xswiftc "-sdk" -Xswiftc "`xcrun --sdk iphonesimulator --show-sdk-path`" -Xswiftc "-target" -Xswiftc "x86_64-apple-ios14.0-simulator"

and join it with previously built library with lipo? Or Swift package provides another way like:

swift build -c release --arch arm64

or something like that?

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum