While working in Swift project, I have two modules, let's say
BaseFeature Base has a SHService class from where I am calling a function of Feature module (of class SHCommon). Feature module is building without error but Base raises error in linking phase.

import Foundation
import Feature
class SHService {
public func printMe(printString: String){
SHCommon().printMe(printString: printString)
}
}
import Foundation
public class SHCommon {
public init(){}
public func printMe(printString: String) {
print(printString)
}
}

Any idea why this is happening?
I had the same error after a long I found the solution that I had to add the not linked framework (library) to any target you important at General -> Frameworks and Libraries
error: type metadata accessor for Module.Class
I got this error in Xcode test target. Solution was:
Test target -> General -> select <app> in Host Application -> Allow testing Host Application APIs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With