我不知道如何修复此错误“无法推断复杂的闭包返回类型;添加显式类型以消除歧义”。我已经尝试了一切(我能做的)但不起作用
import SwiftUI
struct ContentView: View {
@State var content: String = "start"
var body: some View {
VStack { // Unable to infer complex closure return type; add explicit type to disambiguate
self.content = try! String(contentsOf: URL(string: "http://zyglarski.pl/swift-http-docs/tinder_list.php")!)
var contentData = self.content.data(using: .utf8)
var jsDec = JSONDecoder()
var responce = try! jsDec.decode(Candidates.self, from: contentData!)
Text(responce)
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
struct Candidates: Codable {
let candidates:[Candidate]
}
struct …Run Code Online (Sandbox Code Playgroud)