Deferred icon indicating copy to clipboard operation
Deferred copied to clipboard

SPM should use .dynamic packages

Open piercifani opened this issue 5 years ago • 5 comments

Since as of Xcode 11.3 dynamic Swift Packages can be submitted to the AppStore, Deferred should switch to this kind of package in order to ease integration and unit testing of the application.

If we keep it static, we see issues like this when writing unit tests:

objc[97739]: Class _TtC8Deferred18POSIXReadWriteLock is implemented in both /Users/pcifani/Library/Developer/CoreSimulator/Devices/835DF32C-44B3-4841-B6CB-A7B2D12744D7/data/Containers/Bundle/Application/C5053FF1-BF0D-434A-94C6-BAAE5FF414F0/VideoAsk.app/Frameworks/BSWFoundation.framework/BSWFoundation (0x10825ec48) and /Users/pcifani/Library/Developer/CoreSimulator/Devices/835DF32C-44B3-4841-B6CB-A7B2D12744D7/data/Containers/Bundle/Application/C5053FF1-BF0D-434A-94C6-BAAE5FF414F0/VideoAsk.app/VideoAsk (0x106c31310). One of the two will be used. Which one is undefined.

piercifani avatar Dec 23 '19 14:12 piercifani

That would be counter to the recommendation made by Swift Package Manager:

Leave this parameter unspecified to let to let the Swift Package Manager choose between static or dynamic linking (recommended).

We have already received a counter-request to remove the .dynamic setting, which we completed in 8b6d75962d30218a9d012a4f617f86f57dfabecb. Many other libraries do the same, as far as I can see.

I don't quite know what the right answer is here, the documentation also says "[so that it is] based on the preference of the package's consumer", so it seems to imply there's a way. I might suggest asking in the SwiftPM forum.

zwaldowski avatar Dec 24 '19 19:12 zwaldowski

Ok, I'll try asking in the SwiftPM forum, since I can't find any option in the UI to switch this to dynamic

image

piercifani avatar Dec 27 '19 08:12 piercifani

My question on the Swift Forums seems to indicate that there's no way of achieving this in Xcode currently, and since that's the primary form of integration, I think I'd be wise to set this to .dynamic.

Or maybe create a new target called DeferredDynamic?

piercifani avatar Jan 29 '20 09:01 piercifani