Should libraries such as libSwiftCore.dylib be shipped with the product on macOS?

I have ObjectiveC programs built with Xcode 10.3 and distributed as a package to install on macOS 10.12 to latest Monterey.

I am planning to write a new program in Swift language and add it to the package.

I noticed that some other Apps install libraries such as libSwiftCore.dylib in some paths and use.

Should I also install libraries such as libSwiftCore.dylib in some path and use it?

That library is part of the Swift runtime. There’s two possibilites here:

  • If your deployment target is 10.14.4 or later, the Swift runtime is built in to macOS and so you’ll never need to include a copy in your product.

  • If your deployment target is earlier than that, you’ll need to include a copy of the Swift runtime in your product. This will be used if your code runs on an early system.

The only complication is this:

I have Objective-C programs built with Xcode 10.3

Why are you using such an ancient version of Xcode? This matters for two reasons:

  • Xcode 10.3 can’t build for Apple silicon, which means that your product will be relying on Rosetta. Rosetta is a compatibility feature and it’s not hard to imagine it going away at some point (just like it went away] a few years after the PowerPC-to-Intel transition).

  • Xcode 10.3 uses Swift 4 and Swift 4 does not support ABI compatibility. That means it won’t use the runtime built in to the OS, which means you’ll probably need to include the pre-ABI compatibility runtime regardless of your deployment target.

I strongly recommend that you upgrade to Xcode 12, which avoids fixes both of these issues.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Should libraries such as libSwiftCore.dylib be shipped with the product on macOS?
 
 
Q