a common example:
protocol Foo {
}
extension Foo {
static func abc() {
// ...
}
}
class Bar : Foo {
static func abc() {
// do something.
(self as Foo.Type).abc() // it works well
}
}
but if I add associatedtype (like SwiftUI.App) in protocol Foo, it report error:
protocol Foo {
associatedtype Body = Scene
}
extension Foo {
static func abc() {
// ...
}
}
class Bar : Foo {
static func abc() {
// do something.
(self as Foo.Type).abc() // it reports error
}
}
Protocol 'Foo' can only be used as a generic constraint because it has Self or associated type requirements
how to resolve it?