| rr.codes |
| rr.codes |
As promised in my SwiftUI for Mac 2025 article, here is a more detailed article about SwiftUI's new WebView.
https://troz.net/post/2025/swiftui-webview/
The SwiftUI team have done an amazing job on this, and I can't wait to start using it in my apps and books.
When the new SwiftUI WebView API landed in iOS 26 I was so happy. And now… I'm even happier 🤩
- WebPage conforms to Transferable.
- All the loading APIs return an AsyncSequence so you observe the whole navigation process.
- There's a load() overload taking an optional URL, for when URLRequest is too heavyweight.
Chef's kiss-level stuff 🙌
I like API that's tweet-sized 😎
struct ContentView: View {
@State private var page = WebPage()
var body: some View {
WebView(page)
.onAppear {
page.load(URLRequest(url: URL(string: "https:/swift.org")!))
}
}
}