我有一个错误"Closure不能隐式捕获自我参数".请告诉我它是如何解决的?
struct RepoJson {
...
static func get(url: String, completion: @escaping (RepoJson!) -> ()) {
...
}
}
struct UsersJson {
var repo: RepoJson!
init() throws {
RepoJson.get(url: rep["url"] as! String) { (results:RepoJson?) in
self.repo = results //error here
}
}
}
Run Code Online (Sandbox Code Playgroud)