Answers from the documentation; checking which model is on duty
Hi - I answer from the OpenSmartRoute documentation: routing, the API, plans and quotas, self-hosting. Ask away, or open a support ticket if you need a person.
Grounded in the docs - follow a source before acting on it.
webkit-integration - Skill - OpenSmartRoute
Skillv1.0.0
webkit-integration
WebKit integration in SwiftUI using WebView and WebPage for embedding web content, navigation, JavaScript interop, and customization. Use when embedding web content in SwiftUI apps.
Imported from rshankras/claude-code-apple-skills (skills/swiftui/webkit/SKILL.md). Install upstream with npx skills add rshankras/claude-code-apple-skills --skill webkit. Copyright stays with the author.
WebKit Integration for SwiftUI
Embed and control web content in SwiftUI apps using the native WebView struct and WebPage observable class. Covers loading, navigation, JavaScript execution, and view customization.
When This Skill Activates
User wants to display web content inside a SwiftUI app
User needs to load URLs, HTML strings, or data blobs in a web view
User asks about JavaScript interop from SwiftUI
User needs navigation control (back, forward, reload) for embedded web content
User wants to customize web view behavior (gestures, text selection, link previews)
User needs to capture snapshots or export PDFs from web content
User asks about intercepting navigation requests or custom URL schemes
User wants to configure private browsing or custom user agents
Decision Tree
What do you need?
|
+-- Display a URL or HTML content
| +-- Simple, no interaction needed
| | +-- WebView(url:) --> see webview-basics.md
| +-- Need loading state, reload, custom config
| +-- WebPage + WebView(page) --> see webview-basics.md
|
+-- Navigate programmatically (back, forward, intercept)
| +-- Back/forward list, navigation events
| | +-- see navigation.md
| +-- Intercept or cancel navigation requests
| +-- NavigationDeciding protocol --> see navigation.md
|
+-- Execute JavaScript or communicate with web content
| +-- callJavaScript, arguments, content worlds
| +-- see javascript-advanced.md
|
+-- Capture snapshots, export PDF, web archive
| +-- page.snapshot(), page.pdf(), page.webArchiveData()
| +-- see javascript-advanced.md
|
+-- Handle custom URL schemes
+-- URLSchemeHandler protocol --> see javascript-advanced.md
API Availability
API
Minimum OS
Import
WebView
iOS 26 / macOS 26
SwiftUI + WebKit
WebPage
iOS 26 / macOS 26
WebKit
WebPage.Configuration
iOS 26 / macOS 26
WebKit
NavigationDeciding
iOS 26 / macOS 26
WebKit
WKContentWorld
iOS 14 / macOS 11
WebKit
WKSnapshotConfiguration
iOS 11 / macOS 10.13
WebKit
WKPDFConfiguration
iOS 14 / macOS 11
WebKit
Quick Start
Simplest Usage
import SwiftUIimport WebKitstruct BrowserView: View { var body: some View { WebView(url: URL(string: "https://developer.apple.com")!) }}
With WebPage for Full Control
import SwiftUIimport WebKitstruct ControlledBrowserView: View { @State private var page = WebPage() var body: some View { WebView(page) .onAppear { page.load(URLRequest(url: URL(string: "https://developer.apple.com")!)) } }}
Top Mistakes
Mistake
Problem
Fix
Using WebView(url:) when you need navigation control
No access to back/forward, reload, or events
Use WebPage + WebView(page)
Forgetting import WebKit alongside import SwiftUI
WebView is in SwiftUI but WebPage requires WebKit
Always import both
Not observing currentNavigationEvent
Missing loading states, errors go unnoticed
Use onChange(of: page.currentNavigationEvent)
Calling callJavaScript before page finishes loading
Script fails because DOM is not ready
Wait for .finished navigation event
Using persistent data store for private browsing
User data is saved to disk
Use .nonPersistent() on WebsiteDataStore
Not handling nil return from decidePolicyFor(navigationAction:)
Navigation proceeds when it should be cancelled
Return nil to cancel, return NavigationPreferences to allow
Passing JavaScript without argument binding
Vulnerable to injection, hard to debug
Use arguments: parameter for named values
Review Checklist
Using WebPage when any control beyond simple display is needed
Both SwiftUI and WebKit are imported
Navigation events observed for loading indicators and error handling
JavaScript execution waits for page to finish loading
Private browsing uses .nonPersistent() data store
Navigation interception returns correct values (preferences to allow, nil to cancel)
JavaScript arguments passed via arguments: parameter, not string interpolation
Custom URL scheme handler registered on configuration before page loads
Find-in-page enabled with findNavigator(isPresented:) if needed
Appropriate gesture and interaction modifiers applied (back/forward, magnification, text selection)
Content background customized if needed for visual integration
Install webkit-integration and it becomes one more candidate the router can pick - when it fits.
A listing is a routing target with a manifest: what it does, which domains it covers, what it costs and who publishes it. Once installed it sits beside your own models and tools, is scored like any other candidate for each request, and shows up in the trace when it wins. Ratings come from workspaces that installed it, one per account.
When a provider is down or over quota the request moves on; the trace says it did.
Use it
Copy one of these into your project. Installing also returns the manifest and these snippets.
# after Install: the listing is in your workspace's routing pool - a plan picks it for its slotcurl-s-X POST https://api.opensmartroute.ai/api/v1/route -H 'Authorization: Bearer $OSR_API_KEY' -H 'Content-Type: application/json' -d '{"text": "...", "plan": true}'
Manifest
An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.
{
"ocm": "1",
"id": "rshankras-claude-code-apple-skills-webkit",
"kind": "skill",
"name": "webkit-integration",
"description": "WebKit integration in SwiftUI using WebView and WebPage for embedding web content, navigation, JavaScript interop, and customization. Use when embedding web content in SwiftUI apps.",
"publisher": "rshankras",
"version": "1.0.0",
"capabilities": {
"domains": [
"coding",
"customer_support"
],
"tags": [
"skill-md",
"skills-sh"
],
"languages": [
"en"
]
},
"quality_prior": 0.6,
"examples": [
"WebKit integration in SwiftUI using WebView and WebPage for embedding web content, navigation, JavaScript interop, and customization. Use when embedding web content in SwiftUI apps."
],
"primary": false,
"metadata": {
"source": {
"provider": "skills.sh",
"repository": "https://github.com/rshankras/claude-code-apple-skills",
"path": "skills/swiftui/webkit/SKILL.md",
"ref": "HEAD",
"url": "https://github.com/rshankras/claude-code-apple-skills/blob/HEAD/skills/swiftui/webkit/SKILL.md",
"key": "rshankras/claude-code-apple-skills/skills/swiftui/webkit/SKILL.md"
},
"allowed_tools": [
"Read",
"Glob",
"Grep"
]
},
"instructions": "# WebKit Integration for SwiftUI\n\nEmbed and control web content in SwiftUI apps using the native `WebView` struct and `WebPage` observable class. Covers loading, navigation, JavaScript execution, and view customization.\n\n## When This Skill Activates\n\n- User wants to display web content inside a SwiftUI app\n- User needs to load URLs, HTML strings, or data blobs in a web view\n- User asks about JavaScript interop from SwiftUI\n- User needs navigation control (back, forward, reload) for embedded web content\n- User wants to customize web view behavior (gestures, text selection, link previews)\n- User needs to capture snapshots or export PDFs from web content\n- User asks about intercepting navigation requests or custom URL schemes\n- User wants to configure private browsing or custom user agents\n\n## Decision Tree\n\n```\nWhat do you need?\n|\n+-- Display a URL or HTML content\n| +-- Simple, no interaction needed\n| | +-- WebView(url:) --> see webview-basics.md\n| +-- Need loading state, reload, custom config\n| +-- WebPage + WebView(page) --> see webview-basics.md\n|\n+-- Navigate programmatically (back, forward, intercept)\n| +-- Back/forward list, navigation events\n| | +-- see navigation.md\n| +-- Intercept or cancel navigation requests\n| +-- NavigationDeciding protocol --> see navigation.md\n|\n+-- Execute JavaScript or communicate with web content\n| +-- callJavaScript, arguments, content worlds\n| +-- see javascript-advanced.md\n|\n+-- Capture snapshots, export PDF, web archive\n| +-- page.snapshot(), page.pdf(), page.webArchiveData()\n| +-- see javascript-advanced.md\n|\n+-- Handle custom URL schemes\n +-- URLSchemeHandler protocol --> see javascript-advanced.md\n```\n\n## API Availability\n\n| API | Minimum OS | Import |\n|-----|-----------|--------|\n| `WebView` | iOS 26 / macOS 26 | `SwiftUI` + `WebKit` |\n| `WebPage` | iOS 26 / macOS 26 | `WebKit` |\n| `WebPage.Configuration` | iOS 26 / macOS 26 | `WebKit` |\n| `NavigationDeciding` | iOS 26 / macOS 26 | `WebKit` |\n| `WKContentWorld` | iOS 14 / macOS 11 | `WebKit` |\n| `WKSnapshotConfiguration` | iOS 11 / macOS 10.13 | `WebKit` |\n| `WKPDFConfiguration` | iOS 14 / macOS 11 | `WebKit` |\n\n## Quick Start\n\n### Simplest Usage\n\n```swift\nimport SwiftUI\nimport WebKit\n\nstruct BrowserView: View {\n var body: some View {\n WebView(url: URL(string: \"https://developer.apple.com\")!)\n }\n}\n```\n\n### With WebPage for Full Control\n\n```swift\nimport SwiftUI\nimport WebKit\n\nstruct ControlledBrowserView: View {\n @State private var page = WebPage()\n\n var body: some View {\n WebView(page)\n .onAppear {\n page.load(URLRequest(url: URL(string: \"https://developer.apple.com\")!))\n }\n }\n}\n```\n\n## Top Mistakes\n\n| Mistake | Problem | Fix |\n|---------|---------|-----|\n| Using `WebView(url:)` when you need navigation control | No access to back/forward, reload, or events | Use `WebPage` + `WebView(page)` |\n| Forgetting `import WebKit` alongside `import SwiftUI` | `WebView` is in SwiftUI but `WebPage` requires WebKit | Always import both |\n| Not observing `currentNavigationEvent` | Missing loading states, errors go unnoticed | Use `onChange(of: page.currentNavigationEvent)` |\n| Calling `callJavaScript` before page finishes loading | Script fails because DOM is not ready | Wait for `.finished` navigation event |\n| Using persistent data store for private browsing | User data is saved to disk | Use `.nonPersistent()` on `WebsiteDataStore` |\n| Not handling `nil` return from `decidePolicyFor(navigationAction:)` | Navigation proceeds when it should be cancelled | Return `nil` to cancel, return `NavigationPreferences` to allow |\n| Passing JavaScript without argument binding | Vulnerable to injection, hard to debug | Use `arguments:` parameter for named values |\n\n## Review Checklist\n\n- [ ] Using `WebPage` when any control beyond simple display is needed\n- [ ] Both `SwiftUI` and `WebKit` are imported\n- [ ] Navigation events observed for loading indicators and error handling\n- [ ] JavaScript execution waits for page to finish loading\n- [ ] Private browsing uses `.nonPersistent()` data store\n- [ ] Navigation interception returns correct values (preferences to allow, nil to cancel)\n- [ ] JavaScript arguments passed via `arguments:` parameter, not string interpolation\n- [ ] Custom URL scheme handler registered on configuration before page loads\n- [ ] Find-in-page enabled with `findNavigator(isPresented:)` if needed\n- [ ] Appropriate gesture and interaction modifiers applied (back/forward, magnification, text selection)\n- [ ] Content background customized if needed for visual integration\n\n## Reference Files\n\n| File | Contents |\n|------|----------|\n| `webview-basics.md` | WebView creation, WebPage setup, configuration, find-in-page, customization modifiers |\n| `navigation.md` | Loading content, back/forward list, navigation events, NavigationDeciding protocol |\n| `javascript-advanced.md` | JavaScript execution, content worlds, snapshots, PDF export, custom URL schemes |\n\n## Cross-References\n\n- For **macOS window management** around web views, see `macos/architecture-patterns/`\n- For **navigation architecture** that hosts a web view, see `ios/navigation-patterns/`\n- For **Liquid Glass** design around web content, see `design/liquid-glass/`\n\n## References\n\n- [WebView (SwiftUI)](https://developer.apple.com/documentation/swiftui/webview)\n- [WebPage](https://developer.apple.com/documentation/webkit/webpage)\n- [WKContentWorld](https://developer.apple.com/documentation/webkit/wkcontentworld)\n- [WKSnapshotConfiguration](https://developer.apple.com/documentation/webkit/wksnapshotconfiguration)",
"cost": {
"context_tokens": 1415
}
}
Fetch it by URL: GET /api/v1/registry/rshankras-claude-code-apple-skills-webkit/manifest?version=1.0.0
Reviews
Star ratings from people who tried it. One review per account; edit yours any time.
No reviews yet. Install it, try it, and be the first to rate it.