According to Apple engineers, the header <#Module Name#>-Swift.h uses a macro that manages the name to avoid conflicts (see WWDC Swift Interoperability In Depth video starting at 45 min, 40 s). They gave an example of the Document Swift class:
SWIFT_CLASS("_TtC5MyApp10Document") @interface Document : UIDocument
In your Swift code, the class will be available as MyApp.Document if MyApp is the module it is in. So, if you have two Swift classes with the same names from different modules - say, one of them is your own and the other is from the open Swift SomeFramework structure - they will be available for your Swift code as MyApp.Document and SomeFramework.Document ...
However, on the Obj-C side, importing these two classes into the same lexical area results in a Duplicate interface definition for class 'Document' compiler error. It's just Obj-C ... In the vast majority of cases, this will not be a problem, since you can import these two classes into the application if they do not violate each other. Indeed, how often do you want to use MyApp.Document and SomeFramework.Document in the same module of your application? As we move forward in a shorter time, I’m not sure that this particular issue requires a certain strategy compared to pressing issues such as multicore, distributed, functional, tactile, anticipating, portable, autonomous, etc. ..
milos 01 Oct '14 at 18:46 2014-10-01 18:46
source share