---
title: "init(port:data:)"
framework: browserenginekit
role: symbol
role_heading: Initializer
path: "browserenginekit/layerhierarchyhandle/init(port:data:)"
---

# init(port:data:)

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

## Declaration

```swift
init(port: mach_port_t, data: Data) throws
```

## Parameters

- `port`: A Mach port (mach_port_t) that references the layer hierarchy.
- `data`: The serialized data with which to reconstruct the handle.

## Discussion

Discussion Use this initializer to reconstruct a layer hierarchy handle that your app serializes using encode(_:) in another process. This method takes ownership of the Mach port send right, even if an error occurs; don’t use or deallocate the port after calling this method.

## See Also

### Sharing a layer hierarchy handle using Mach

- [encode(_:)](browserenginekit/layerhierarchyhandle/encode(_:).md)
