Force Xcode 11 to use a SPM library as a dylib

Is there a way to force Xcode to consume a library added via Swift Packages as a dynamic lib? The only way I've found so far is to modify the Package.swift of the imported package.

Do I miss an option in Xcode (I'm using Xcode 11 beta 4)?

@Aciid would know :slight_smile:

As far as I am aware, Xcode will always link statically unless it is defined in the dependencies package file that it should be linked dynamically. However, there is one workaround you can use without changing the package file. You can link the package into a dynamic framework which contains an @_exported import; therefor, re-exporting everything. Afterwards, you can use this dynamic framework instead of the original one and avoid duplicated symbols.

Note: I think it might be required to add a load_all linker flag, although I am not sure right now if this is needed

A work-around have been described in this thread: How to link a Swift Package as dynamic