我在协议中创建了一个方法,该方法返回了另一个协议。当我尝试在此返回的协议中使用关联方法时,我收到有关以下错误的信息:Protocol 'CoordinteProtocol' can only be used as a generic constraint because it has Self or associated type requirements
这是我的示例代码:
protocol CoordinteProtocol {
associatedtype Result
func getCoords() -> Result?
}
protocol LocationProtocol {
func getLocationWith() -> CoordinteProtocol? //error -> Protocol 'CoordinteProtocol' can only be used as a generic constraint because it has Self or associated type requirements
}
是否有可能解决此问题?