<!--
{
  "availability" : [
    "iOS: 17.4.0 -",
    "iPadOS: 17.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "BrowserEngineKit",
  "identifier" : "/documentation/BrowserEngineKit/LayerHierarchyHandle",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "BrowserEngineKit"
    ],
    "preciseIdentifier" : "c:objc(cs)BELayerHierarchyHandle"
  },
  "title" : "LayerHierarchyHandle"
}
-->

# LayerHierarchyHandle

A reference to a layer hierarchy that your app shares between processes.

```
class LayerHierarchyHandle
```

## Overview

By sharing a reference, or *handle*, to your app’s layer hierarchy between processes, you can coordinate layer updates across multiple processes. Get a handle from a [`LayerHierarchy`](/documentation/BrowserEngineKit/LayerHierarchy) object, then share it with another process using one of the serialization methods.

Use [`createXPCRepresentation()`](/documentation/BrowserEngineKit/LayerHierarchyHandle/createXPCRepresentation()) and [`init(xpcRepresentation:)`](/documentation/BrowserEngineKit/LayerHierarchyHandle/init(xpcRepresentation:)) to share layer handles across your app’s processes. Apps with existing Mach-based interprocess communication implementations can use [`encode(_:)`](/documentation/BrowserEngineKit/LayerHierarchyHandle/encode(_:)) and [`init(port:data:)`](/documentation/BrowserEngineKit/LayerHierarchyHandle/init(port:data:)) methods to share layer handles.

For more information, see [Hosting browser view layers in the rendering extension](/documentation/BrowserEngineKit/hosting-browser-view-layers-in-the-rendering-extension).

## Topics

### Sharing a layer hierarchy handle using XPC

[`func createXPCRepresentation() -> xpc_object_t`](/documentation/BrowserEngineKit/LayerHierarchyHandle/createXPCRepresentation())

Creates an object representing this handle that you send to another process in an XPC message.

[`init(xpcRepresentation: xpc_object_t?) throws`](/documentation/BrowserEngineKit/LayerHierarchyHandle/init(xpcRepresentation:))

Creates a handle from a representation received in an XPC message.

### Sharing a layer hierarchy handle using Mach

[`func encode((mach_port_t, Data) -> Void)`](/documentation/BrowserEngineKit/LayerHierarchyHandle/encode(_:))

Serializes the hierarchy handle into a Mach port reference and accompanying data.

[`init(port: mach_port_t, data: Data) throws`](/documentation/BrowserEngineKit/LayerHierarchyHandle/init(port:data:))

Creates a layer hierarchy handle using a Mach port reference and serialized data.

### Creating a layer hierarchy handle

[`init?(coder: NSCoder)`](/documentation/BrowserEngineKit/LayerHierarchyHandle/init(coder:))

Creates a handle from an encoded representation.

## Relationships

### Conforms To

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`Sendable`](/documentation/Swift/Sendable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`CVarArg`](/documentation/Swift/CVarArg)

[`NSSecureCoding`](/documentation/Foundation/NSSecureCoding)

[`Hashable`](/documentation/Swift/Hashable)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

[`NSCoding`](/documentation/Foundation/NSCoding)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)