Contents

lynnswap/webinspectorkit

UIKit Web Inspector for WKWebView.

Features

  • DOM tree browsing
  • Network request logging
  • Built-in DOM and Network tabs

Requirements

  • Swift 6.3+
  • iOS 18+
  • ARM64/ARM64e Apple runtime; Intel Mac / x86_64 simulator environments are not

supported.

Platform Notes

  • The current implementation targets UIKit on iOS.
  • AppKit support is planned to be rebuilt separately.

Products

| Product | Use when | | --- | --- | | WebInspectorKit | You want the built-in UIKit inspector UI. | | WebInspectorDataKit | You want observable DOM, Network, Console, Runtime, and CSS models for a custom UI. | | WebInspectorDataKitTesting | You want deterministic WebInspectorContext startup synchronization in tests. | | WebInspectorProxyKit | You want typed Web Inspector protocol commands and events directly over an inspected WKWebView. | | WebInspectorProxyKitTesting | You want a controllable proxy backend and protocol fixtures without the native WebKit bridge. |

Quick Start

UIKit

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)
        }
    }
}

Tabs

let inspector = WebInspectorViewController(
    tabs: [.dom, .network]
)

The built-in tab surface exposes DOM and Network tabs. Apps can also add UIKit tabs with a UIViewController factory:

let consoleTab = WebInspectorTab(
    id: "app_console",
    title: "Console",
    systemImage: "terminal"
) { session in
    ConsoleViewController(inspectorSession: session)
}

let inspector = WebInspectorViewController(
    tabs: [.dom, .network, consoleTab]
)

Testing against real WebKit

The repository includes a self-authored, loopback-only integration site for manual Monocly verification through a real WKWebView and WebKit protocol backend. It combines a large DOM, mutation burst, iframe, shadow/pseudo nodes, navigation, and representative Network traffic without third-party assets:

DEVICE_UDID=<booted-simulator-udid> Scripts/run-monocly-fixture.sh

See Inspector Integration Fixture for the verification matrix and deterministic fixture regression test.

Documentation

The DocC workflow publishes package documentation to GitHub Pages.

| Document | Purpose | | --- | --- | | Migration Guide | Version-by-version source migration notes for app code. | | WebInspectorUI | UIKit inspector implementation notes and UI/DataKit ownership boundaries. | | WebKit Version Mapping | Local notes for mapping iOS WebKit framework versions to public WebKit source refs. |

Project Structure

Sources/
  WebInspectorKit/             Public built-in inspector product.
  WebInspectorDataKit/         Observable inspector model product.
  WebInspectorDataKitTesting/  Deterministic DataKit consumer test helpers.
  WebInspectorProxyKit/        Typed protocol proxy product.
  WebInspectorProxyKitTesting/ Controllable proxy test runtime and fixtures.
  WebInspectorUI*/             Internal UIKit implementation targets.
Packages/
  WebInspectorNativeBridge/    Local native bridge package for ProxyKit internals.
Docs/
  MIGRATION.md                 Version-by-version migration notes.
  WebKitVersionMapping.md      WebKit runtime/source mapping notes.

License

See LICENSE.

Package Metadata

Repository: lynnswap/webinspectorkit

Default branch: main

README: README.md