---
title: "init(frame:device:)"
framework: metalkit
role: symbol
role_heading: Initializer
path: "metalkit/mtkview/init(frame:device:)"
---

# init(frame:device:)

Initializes a view with the specified frame rectangle and Metal device.

## Declaration

```swift
init(frame frameRect: CGRect, device: (any MTLDevice)?)
```

## Parameters

- `frameRect`: The frame rectangle for the view.
- `device`: The Metal device object to use.

## Return Value

Return Value An initialized view object.

## See Also

### Creating a View

- [init(coder:)](metalkit/mtkview/init(coder:).md)
