Swift extension method not accessible in Cpp using interop

I have a project implementing new interop mechanism and I m able to successfully invoke swift class method directly from swift. However, when I try to invoke the swift extension method it produces an error : No member named 'GetExtData' in 'InteropExtension::SwiftCode'

Below is my cpp code:

#include "CppSource.hpp"
#include "InteropExtension-Swift.h"

void CppSource::CppToSwiftCall()
{
    // successfull call
    InteropExtension::SwiftCode::GetClassData();
    
    //Below call is causing error. Why is swift extension method not invoked?
    InteropExtension::SwiftCode::GetExtData();

}

Below is my swift code:


import Foundation


public class SwiftCode {
    
    public static func GetClassData () -> String
    {
        return "classMethod"
    }
        
}

extension SwiftCode {
    
    public static func GetExtData () -> String
    {
        return "ExtMethod"
    }
}

Can someone helpout on why is the extension methods not being invoked, and how can I invoke it?

I’m gonna recommend that you post this question to Swift Forums, where there’s a great community of folks with Swift / C++ interoperability experience.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Swift extension method not accessible in Cpp using interop
 
 
Q