What problem does it solve?
Many SwiftUI apps need an embedded web surface that the app can observe, control, and integrate with native UI; this Skill explains how to correctly embed web content, run JavaScript, intercept navigation, and host bundled or offline HTML while avoiding common pitfalls and unsafe patterns.
Core Features & Use Cases
- Modern SwiftUI WebKit guidance: prefer WebView and WebPage for iOS 26+ and observe page state such as title, url, estimated progress, and navigation events.
- Navigation policy control: implement WebPage.NavigationDeciding to keep owned domains in-app and hand off external links safely.
- JavaScript integration: callJavaScript with typed argument passing and defensive casting of results for page-driven interactions.
- Local content and custom schemes: register URLSchemeHandler to serve bundled HTML/CSS/JS and handle cancellation semantics.
- Migration and fallbacks: decision guide for when to use SFSafariViewController, ASWebAuthenticationSession, or WKWebView as intentional fallbacks.
- Review checklist and common mistakes to validate safe, focused embedded web experiences.
Quick Start
Create a WebPage in your SwiftUI view, load the desired URL or local resource, observe title and loading progress, and implement a NavigationDeciding to route external links out of the embedded surface.