UIKit Web Inspector for WKWebView.
Warning
This package relies on undocumented APIs and runtime behavior, so extra care is needed before using it in App Store-bound projects.
- DOM tree browsing with native UIKit/TextKit2 presentation
- Network request logging with native list/detail presentation
- Built-in DOM and Network tabs
- Explicit lifecycle via
WebInspectorSession/WebInspectorViewController(attach(to:),detach()) - Observation-backed WebInspector model state
- Swift 6.2+
- iOS 18+
- WKWebView with JavaScript enabled
- The current implementation targets UIKit on iOS.
- AppKit support is planned to be rebuilt separately.
import UIKit
import WebKit
import WebInspectorKit
final class BrowserViewController: UIViewController {
private let pageWebView = WKWebView(frame: .zero)
@objc private func presentInspector() {
let inspector = WebInspectorViewController()
inspector.modalPresentationStyle = .pageSheet
if let sheet = inspector.sheetPresentationController {
sheet.detents = [.medium(), .large()]
sheet.selectedDetentIdentifier = .medium
}
Task { @MainActor in
try await inspector.attach(to: pageWebView)
present(inspector, animated: true)
}
}
}let inspector = WebInspectorViewController(
tabs: [.dom, .network]
)The current public tab surface exposes the built-in DOM and Network tabs.
Start with MIGRATION.md when updating from an older
release.
For implementation work, ArchitectureOverview.md
is the top-level map for module boundaries, runtime ownership, and transport
flow. Core-specific model notes are rooted at the
WebInspectorCore README, which links to
the detailed DOM, CSS, Network, and transport research docs kept next to the
Core target.
See LICENSE.
