10

Consider:

  • A Swift framework called FrameworkA that defines the type Thing.
  • A Swift framework called FrameworkB that also defines the type Thing and the type FrameworkA.
  • An app that imports both frameworks in the same Swift file.

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
hpique
  • 119,096
  • 131
  • 338
  • 476

1 Answers1

16

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.

hpique
  • 119,096
  • 131
  • 338
  • 476