Undefined symbols for architecture arm64 when using a swift class imported to objective C

Hello, I am pretty new to swift and objc development, and I am currently facing a problem :
I am building a project, in which I try to use a class defined in a swift file (myClass.swift), into an objective-C++ file (usesMyClass.mm).

To do so, I created a swift to objc header (myClass-Swift.h) with the command
swiftc myClass.swift -emit-objc-header -emit-objc-header-path myClass-Swift.h
and included it into my objcpp file (#import "myClass-Swift.h").

Yet, when I compile, I get the following error :
Undefined symbols for architecture arm64:   "_OBJC_CLASS_$__TtC16MyClass16Myclass", referenced from: objc-class-ref in usesMyClass.o.

When I generated the -Swift.h file, the command also generated a .swiftmodule file, that I try to add to the project in Target->Build Phases->link binary with libraries, as I read that a .swiftmodule was a binary, but I still got the error. I checked if the myClass.swift file was correctly added to the sources of the project, and it was. I can't have the header in the target build as it is an App target, and the header is never used in the framework target.

Would anyone have an answer ?

N.B. : It seems the "Undefined symbols" error is pretty current but I have not found anything that matches exactly my problem and, thus, could help me get through it.

I ended up finding the solution : I tried to instantiate the instance of the swift class like this :

@Interface usesMyClass () {
    MyClass *myClassInstance;
};
@end

@Implementation
-(void)function
{
    self->myClassInstance = [[myClass alloc] initWithParameter: parameter];
}
@end

When I had to implement it this way :

@Interface usesMyClass () {
    MyClass *myClassInstance;
};
@end

@Implementation
-(void)function
{
    [self->myClassInstance  initWithParameter: parameter];
}
@end
Undefined symbols for architecture arm64 when using a swift class imported to objective C
 
 
Q