Hello I was trying to import a C++ .h (the library that I want to use) that is a template class and specialize this class in Swift so that I have the C++ class only with floats. I'm doing this on Ubuntu so I compile from terminal. I don't know which is the correct way to do it but after I read the documentation here, I did this:
module cppClassLib {
header "cppClass.h"
export *
}
then in the Swift file I did
import cppClassLib
struct CppClass<Float>{
func printHello(){
print("Hello")
}
}
The C++ class is kind of this:
cppClass.h
template <class T> class CppClass {
// Some methods
}
I don't know if this is the correct way but it seems that is the only way to make it compile. If now I create a variable of type CppClass<Float> I can call the printHello but I cannot call any method that is inside the CppClass in the .h file.
If someone can help me I will be really grateful.
Thanks