I have an Objective-C library that imports another Objective-C library I’ve built. I’m trying to support Swift Package Manager in them, even though they’re Objective-C, because they can still be useful from Swift. The first package creates an extension on UIDevice, so it needs to link with UIKit. I can get this to work by adding the following to my target declaration in the first library’s Package.swift:
linkerSettings: [
.linkedFramework("UIKit")
]
This works fine and the second library can happily import it. However, I also support watchOS in the second library, so if I change the first library’s target to the following, it no longer builds:
linkerSettings: [
.linkedFramework("UIKit", .when(platforms: [.iOS, .tvOS])),
.linkedFramework("WatchKit", .when(platforms: [.watchOS]))
]
Now I get errors in Xcode about missing symbols from UIKit. If I try to remove the .when parts from the .linkedFramework invocations, I get an error in Xcode because WatchKit is not available.
Is this a supported configuration, or is this a bug in the linker settings?
NeoNacho
(Boris Buegling)
2
This sounds like a bug to me. Do you have branches on those libraries that I could use to reproduce?
1 Like
Yes, they are:
Thank you for looking into it!
1 Like