Claude
Skills
Sign in
Back

browserenginekit

Included with Lifetime
$97 forever

Build alternative browser engines using BrowserEngineKit. Use when developing a non-WebKit browser engine for iOS/iPadOS in supported regions, managing web content/rendering/networking extension processes, configuring GPU and networking process capabilities, checking alternative-engine device eligibility, or reviewing BrowserEngineKit entitlements and Info.plist setup.

Writing & Docs

What this skill does


# BrowserEngineKit

Framework for building web browsers with alternative (non-WebKit) rendering
engines on iOS and iPadOS. Provides process isolation, XPC communication,
capability management, and system integration for browser apps that implement
their own HTML/CSS/JavaScript engine. Examples target Swift 6.3 and current
Apple SDKs.

BrowserEngineKit is a specialized framework. Alternative browser engines are
available only through Apple-approved entitlement profiles and supported-region
device eligibility. EU support applies to eligible users on iOS 17.4+ and
iPadOS 18+; Japan support starts with iOS 26.2 and adds explicit PAC/MIE
security requirements for browser apps. Development and testing can occur
anywhere. The companion frameworks BrowserEngineCore (low-level primitives) and
BrowserKit (eligibility checks, data transfer) support the overall workflow.

## Contents
- [Overview and Eligibility](#overview-and-eligibility)
- [Entitlements](#entitlements)
- [Architecture](#architecture)
- [Process Management](#process-management)
- [Extension Types](#extension-types)
- [Capabilities](#capabilities)
- [Layer Hosting and View Coordination](#layer-hosting-and-view-coordination)
- [Text Interaction](#text-interaction)
- [Sandbox and Security](#sandbox-and-security)
- [Downloads](#downloads)
- [Common Mistakes](#common-mistakes)
- [Review Checklist](#review-checklist)
- [References](#references)

## Overview and Eligibility

### Eligibility Checking

Use `BEAvailability` from the BrowserKit framework to check whether the device
is eligible for alternative browser engines. `BEAvailability` is available on
iOS/iPadOS 18.4+:

```swift
import BrowserKit

do {
    let eligible = try await BEAvailability.isEligible(for: .webBrowser)
    guard eligible else { return /* fall back or explain */ }
    // Device supports alternative browser engines
} catch {
    // Handle eligibility lookup failure
}
```

Eligibility depends on the device region and OS version. Do not hard-code
region checks; rely on the system API.

Availability anchors: process APIs are iOS/iPadOS 17.4+, `BEDownloadMonitor`
is iOS 18.2+, `.revision2` restricted sandbox is iOS 26+, and
`RenderingExtensionFeature.coreML` is iOS 26.2+.

## Entitlements

### Browser App (Host)

The host app requires two entitlements:

| Entitlement | Purpose |
|---|---|
| `com.apple.developer.web-browser` | Enables default-browser candidacy |
| `com.apple.developer.web-browser-engine.host` | Enables alternative engine extensions |

Both must be requested from Apple. The request process varies by region.

### Extension Entitlements

Each extension target requires its type-specific entitlement set to `true`:

| Extension Type | Entitlement |
|---|---|
| Web content | `com.apple.developer.web-browser-engine.webcontent` |
| Networking | `com.apple.developer.web-browser-engine.networking` |
| Rendering | `com.apple.developer.web-browser-engine.rendering` |

### Optional Entitlements

| Entitlement | Extension | Purpose |
|---|---|---|
| `com.apple.security.cs.allow-jit` | Web content | JIT compilation of scripts |
| `com.apple.developer.kernel.extended-virtual-addressing` | Web content | Required alongside JIT |
| `com.apple.developer.memory.transfer_send` | Rendering | Send memory attribution; value is host app bundle ID |
| `com.apple.developer.memory.transfer_accept` | Web content | Accept memory attribution; value is host app bundle ID |
| `com.apple.developer.web-browser-engine.restrict.notifyd` | Web content | Restrict notification daemon access |

### Embedded Browser Engine (Non-Browser Apps)

Apps that are not browsers but embed an alternative engine for in-app browsing
use different entitlements:

| Entitlement | Purpose |
|---|---|
| `com.apple.developer.embedded-web-browser-engine` | Enable embedded engine |
| `com.apple.developer.embedded-web-browser-engine.engine-association` | Declare engine ownership |

`engine-association` is available starting iOS/iPadOS/Mac Catalyst 26.2 and is
set to `first-party` when you own the engine or `third-party` when another
developer owns it. Embedded engines use `arm64` only (not `arm64e`), cannot
include browser extensions, and cannot use JIT compilation.

### Japan-Specific Requirements

Browser apps distributed in Japan are supported on iOS 26.2+ and must adopt the
current security mitigations Apple lists for Japan, including Pointer
Authentication Codes and Memory Integrity Enforcement for relevant allocators
and extension processes. Enable hardware memory tagging with
`com.apple.security.hardened-process.checked-allocations`; Apple strongly
recommends enabling it in the EU as well.

## Architecture

A browser built with BrowserEngineKit consists of four components running in
separate processes:

```
Host App (UI, coordination)
  |
  |-- XPC --> Web Content Extension (HTML parsing, JS, DOM)
  |-- XPC --> Networking Extension (URLSession, sockets)
  |-- XPC --> Rendering Extension (Metal, GPU, media)
```

The host app launches and manages all extensions. Extensions cannot launch
other extensions. Extensions communicate with each other through anonymous XPC
endpoints brokered by the host app.

### Bootstrap Sequence

1. Host launches web content, networking, and rendering extensions
2. Host creates XPC connections to each extension
3. Host requests anonymous XPC endpoints from networking and rendering
4. Host sends both endpoints to the web content extension via a bootstrap
   message
5. Web content extension connects directly to networking and rendering

This architecture follows the principle of least privilege: the web content
extension works with untrusted data but has no direct OS resource access.

## Process Management

### Launching Extensions

Each extension type has a corresponding process class in the host app:

```swift
import BrowserEngineKit

// Web content (one per tab or iframe)
let contentProcess = try await WebContentProcess(
    bundleIdentifier: nil,
    onInterruption: {
        // Handle crash or OS interruption
    }
)

// Networking (typically one instance)
let networkProcess = try await NetworkingProcess(
    bundleIdentifier: nil,
    onInterruption: {
        // Handle interruption
    }
)

// Rendering / GPU (typically one instance)
let renderingProcess = try await RenderingProcess(
    bundleIdentifier: nil,
    onInterruption: {
        // Handle interruption
    }
)
```

Pass `nil` for `bundleIdentifier` to use the default extension target. The
interruption handler fires if the extension crashes or is terminated by the OS.

### Creating XPC Connections

```swift
let connection = try contentProcess.makeLibXPCConnection()
// Use connection for inter-process messaging
```

Each process type provides `makeLibXPCConnection()` to create an
`xpc_connection_t` for communication.

### Stopping Extensions

```swift
contentProcess.invalidate()
```

After calling `invalidate()`, no further method calls on the process object
are valid.

## Extension Types

### Web Content Extension

Hosts the browser engine's HTML parser, CSS engine, JavaScript interpreter,
and DOM. Conform to `WebContentExtension` to handle incoming XPC connections:

```swift
import BrowserEngineKit

@main
struct MyWebContentExtension: WebContentExtension {
    func handle(xpcConnection: xpc_connection_t) {
        // Set up message handlers on the connection
    }
}
```

Configure via `WebContentExtensionConfiguration` in the extension's
`EXAppExtensionAttributes`.

### Networking Extension

Handles all network requests using `URLSession` or socket APIs. One instance
serves all tabs:

```swift
import BrowserEngineKit

@main
struct MyNetworkingExtension: NetworkingExtension {
    func handle(xpcConnection: xpc_connection_t) {
        // Handle network request messages
    }
}
```

Configure via `NetworkingExtensionConfiguration`.

### Rendering Extension

Accesses the GPU via Metal for video decoding, compositing, and complex
rendering. One instance typically serves the entire browse

Related in Writing & Docs