Objective-C and Swift interoperability in the lldb console.


Alex Zavatone
 

I have some utility classes with class methods in Objective-C and a copy in Swift. For now, I am using the Swift version, but calling one of the methods from a class that is Objective-C. While I have imported the bridging header and the Swift class method works as expected in the Objective-C code, but not in the console. the console reports “use of undeclared identifier” for the class name when I use either the Objective-C or Swift form to call a method in that class.

Both po and v return the same results.

Any ideas?

Thanks in advance,
Alex Zavatone


Alex Zavatone
 

Surprisingly, the Objective-C class’s Swift interface works fine in lldb when viewed from a Swift class.

When trying the. Swift version, I even added @objcMembers to the Swift class declaration or @objc to the methods, and checked that the interface is in the auto-generated Obj-C interface but still the lldb console refuses to recognize the class when used from an Obj-C class even when the -Swift.h file is imported.

The Swift class works in the Obj-C class, but is unrecognized in the lldb console.

On Jun 25, 2019, at 10:32 AM, Alex Zavatone via Groups.Io <zav=mac.com@groups.io> wrote:

I have some utility classes with class methods in Objective-C and a copy in Swift. For now, I am using the Swift version, but calling one of the methods from a class that is Objective-C. While I have imported the bridging header and the Swift class method works as expected in the Objective-C code, but not in the console. the console reports “use of undeclared identifier” for the class name when I use either the Objective-C or Swift form to call a method in that class.

Both po and v return the same results.

Any ideas?

Thanks in advance,
Alex Zavatone