malcommac / SwiftDate

🐔 Toolkit to parse, validate, manipulate, compare and display dates, time & timezones in Swift.
MIT License
7.64k stars 768 forks source link

Added support Swift Package .automatic, .static and .dynamic linking support in order to share same package between multiple targets #728

Closed geraldvoit closed 4 years ago

geraldvoit commented 4 years ago

Fixes Xcode 11.4 error:

Swift package product 'SwiftDate' is linked as a static library by '' and 'Today Extension'. This will result in duplication of library code.

Allows to share the library across multiple targets (iOS App, Today Extension, watchOS, … ) in the same project.

alpi commented 4 years ago

would be great if this could be merged!

geraldvoit commented 4 years ago

Fixes Xcode 11.4 error:

Swift package product 'SwiftDate' is linked as a static library by '' and 'Today Extension'. This will result in duplication of library code.

Allows to share the library across multiple targets (iOS App, Today Extension, watchOS, … ) in the same project.

According to forums.swift.org this issue not about dynamic linking. Seems like a bug in Xcode 11.4. Adding the user defined build setting DISABLE_DIAMOND_PROBLEM_DIAGNOSTIC allows to use static linked Swift Packages in multiple targets.

Furthermore, embedding dynamic linked Swift Packages in multiple targets (e.g. main ios app and today extension) causes an error during the distribution process to the app store.

Bildschirmfoto 2020-04-07 um 10 31 47

Nonetheless, this pull request is still useful regarding different linking options. See https://developer.apple.com/documentation/swift_packages/product .