Post

Replies

Boosts

Views

Created

Framework init param is not a member type of class
I am working on one framework and it is working fine if it is directly connected to the test app in the same project. But when I build it for release and implement it into another test app it shows me this error: Failed to build module 'MySDK' for importation due to the errors above; the textual interface may be broken by project issues or a compiler bug After some digging, I get an error message  ... is not a member type of class ...  And the problem is in the initial parameter and in my observer this is my entry / init class: public class MySdk { ... public init(eventObserver: MyResultObserver){ // this observer is a problem maker EventObserver.shared.attach(eventObserver) }; public init(){} ... and this is how my MyResultObserver looks like (it is in a separate file) import Foundation public protocol WalleePaymenResultObserver: AnyObject {   func success(successMessage: String)   func error(errorMessage: String) } and extension: import Foundation extension MyResultObserver: NSCopying { func copy(with zone: NSZone? = nil) -> Any { return self } } How should it work (it is working in a test project in that SDK folder) import UIKit import MySdk class ViewController: UIViewController, MyResultObserver { // added observer here func success(successMessage: String) {} // observer function 1 func error(errorMessage: String) {} // observer function 2 ... @IBAction func openSdkClick(){ let myAwesomeSdk = MySDK(eventObserver: self) // init my sdk with observer } } But the problem is when I implement it like this into the test app (as cocoa pod) it will give me an error above. I try to remove this observer parameter and SDK works fine. How can I make my observer visible? Should I put it into headers somewhere? any hint?
0
0
708
Nov ’22