A super-basic way to get plain text from a URL is:
struct ContentView: View {
@State private var mytext = "loading..."
func loadData() async {
do {
let url = URL(string: "https://thespia.com/test/")!
mytext = try String(contentsOf: url)
} catch {
print("something went wrong") // TODO - report the actual error
}
}
var body: some View {
Text(mytext)
.task {
await loadData()
}
}
}