Do Not Copy Swift Libraries with Xcode 8

How to exclude standard but unused libswift*.dylib's from macOS app bundle and reduce bundle size

Simply put, it's not possible to exclude the standard libraries that Swift automatically includes with an app and expect it to work. Currently any application created with Swift bundles its own version of the Swift Dynamic Library. Swift doesn’t live on the OS, rather it lives within each app bundle. What this means is that any app that is using Swift 4.1 for example bundles in the Swift 4.1 Dynamic Library (containing the 4.1 ABI), and so forth.

One of the things on the Swift project roadmap is to eventually have ABI Stability. If Swift becomes ABI Stable, Swift will live within the OS and it’s ABI will be compatible with every version of Swift.

Copy swift standard libraries build step does not include SwiftOnoneSupport.dylib

I also had this same issue with two of my frameworks. The strangest thing was that everything was working fine with one of them but not with the other.

While I wasn't able to figure out why this happens (since it seems to be an Xcode bug), I was able to find a pretty neat workaround.

Turns out that using print() anywhere in your code will somehow force libswiftSwiftOnoneSupport.dylib to be loaded. So, by adding something like this the problem should go away:

private func dummy() { 
print("Hello world!")
}

I'm using Xcode 10.1, Swift 4.2 and the pod that was giving me this issue was Nimble.

Hope this helps!

XCode 8.0 app building ultraslow

So... i finally snapped and deleted all my Apple ID keys (except 1 key pair) from my Keychain (was terrified about breaking things).
Now everything builds quickly / normally and i can finally be happy again...

Just to reiterate – make sure you don't have duplicate keys in Keychain.



Related Topics



Leave a reply



Submit