Is it possible to use types defined in Swift packages in Obj-C code in Xcode 11?
This document: https://developer.apple.com/documentation/swift/imported_c_and_objective-c_apis/importing_swift_into_objective-c (assuming that I understand it correctly) seems to imply that Xcode will auto-generate appropriate headers to allow the user to reference Swift types in Obj-C code.
I would like to use a Swift package in an Obj-C codebase that I have for an old macOS Cocoa application. In Xcode 11 it appears to be possible to add Swift packages to projects, even if they are Obj-C based.
The documentation linked above states:
You can work with types declared in Swift from within the Objective-C code in your project by importing an Xcode-generated header file. This file is an Objective-C header that declares the Swift interfaces in your target, and you can think of it as an umbrella header for your Swift code. You don’t need to do anything special to create the generated header—just import it to use its contents in your Objective-C code.
The header's name is generated from your product module name, followed by
When you're building an app target, you can import your Swift code into any Objective-C
.mfile within that same target using this syntax and substituting the appropriate name:
However, when I try to test this by using the sample Swift Library 'DeckOfCards' Xcode cannot find the generated header.
Am I being an idiot, or is this something that isn't intended to be supported in the Xcode / Obj-C / Swift / SPM interoperability?
let package = Package( name: "DeckOfPlayingCards", products: [ .library(name: "DeckOfPlayingCards", targets: ["DeckOfPlayingCards"]), ],