non-nominal type X does not support explicit initialization non-nominal type X does not support explicit initialization ios ios

non-nominal type X does not support explicit initialization


You just need to use init explicitly whenever you're initializing a generic parameter rather than a "real" type:

self.c = C.init(modelView: m)


Use C.init(modelView: m) rather than C(modelView: m). That should fix it.


Please check :

In your code you are doing like this C : MainViewControllerInterface, C : UIViewController.

It is treating C as ViewController, then there is no init in ViewController like init(modelView: M) thats why its throwing error

public class Other<C, M> : NSObject where C : MainViewControllerInterface, M : MainControllerToModelInterface, C.MODELVIEW == M {    var c : C?    override init() {        let m = M()        self.c = C(modelView: m)        super.init()    }}


matomo