我真的是编码新手,我正在尝试 swiftSoup,但是当我输入代码时,它给了我这个错误:(包含控制流语句的闭包不能与结果生成器'ViewBuilder'一起使用)如果我输入代码在错误的地方,或者我忘记了什么!
这是代码
import SwiftUI
import SwiftSoup
struct ContentView: View {
var body: some View {
do {
let html = "<html><head><title>First parse</title></head>"
+ "<body><p>Parsed HTML into a doc.</p></body></html>"
let doc: Document = try SwiftSoup.parse(html)
let p: Element = try doc.select("title").first()!
rint(p)
} catch Exception.Error(let type, let message) {
print(message)
} catch {
print("error")
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}