This question has been asked a few times, beneath my question are the linked other questions with an explanation why it didn't worked out well.
This is my code:
protocol SomeProtocol {
init()
}
protocol Initializable where Self: SomeProtocol {}
protocol ProtocolA {
associatedtype A: Initializable
}
extension ProtocolA {
func a() {
A()
}
}
The error is:
Non-nominal type 'Self.A' does not support explicit initialization
I do not understand why not. The associated type A
always is a type of SomeProtocol
, which has the initializer.
Tried: non-nominal type X does not support explicit initialization : Type 'Self.A' has no member 'init' Swift 4: Non-nominal type 'T' does not support explicit initialization when converting Objective-c to Swift : whole something else Swift 4: "Non-nominal type 'T' does not support explicit initialization" : I think the compiler doesn't really have the know the exact type.