我有以下协议:
protocol ViewCreator {
associatedtype ResultView: View
@ViewBuilder func createView() -> ResultView
}
我想知道它的类型,比如它的名字.因此,我编写了以下代码:
let typeName = String(describing: ViewCreator.self)
但出现以下错误:
协议‘ViewCreator’只能用作泛型约束,因为它具有自身或关联的类型要求.
在这种情况下,我如何才能获得具有关联类型的协议的"self"?
该协议的附注I don't have an implementation在范围内.