cerphin
cerphin

Reputation: 51

Imported namespaces in Swift

I am importing a Objective-C framework into Swift that uses namespaces. Eg:

namespace A {

    struct B {
       ......
    };

     class C { 
        ....
    };
}

I am unable to declare a variable of type B or C. How does Swift interoperate with namespaces?

Upvotes: 0

Views: 533

Answers (1)

Wojtek Surowka
Wojtek Surowka

Reputation: 20993

Objective C does not support namespaces or classes. The code you quoted is Objective C++. Swift - Objective C++ interop is not supported:

You cannot import C++ code directly into Swift. Instead, create an Objective-C or C wrapper for C++ code.

(Quote from Using Swift with Cocoa and Objective-C).

Upvotes: 3

Related Questions