Consider:
FrameworkA
that defines the type Thing
.FrameworkB
that also defines the type Thing
and the type FrameworkA
.How do I reference FrameworkA.Thing
in said file? The following line fails with Thing is not a member of FrameworkA
.
let t : FrameworkA.Thing? = nil
Swift modules make the need for class prefixes obsolete. Even though modules are an important step forward, they're not as flexible as many developers would want them to be. Swift currently doesn't offer a solution to namespace types and constants within modules.
A dynamic property type that allows access to a namespace defined by the persistent identity of the object containing the property (e.g. a view). iOS 14.0+ iPadOS 14.0+ macOS 11.0+ Mac Catalyst 14.0+ tvOS 14.0+ watchOS 7.0+
This appears to be a Swift bug. As a workaround, you can create a new Swift file in the app that imports only FrameworkA
and defines a typealias
for Thing
:
import FrameworkA
typealias ThingA = Thing
Then in the file that needs to import both frameworks, you use ThingA
instead of FrameworkA.Thing
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With