---
title: "init(mtlDevice:)"
framework: coreimage
role: symbol
role_heading: Initializer
path: "coreimage/cicontext/init(mtldevice:)-swey"
---

# init(mtlDevice:)

Creates a Core Image context using the specified Metal device.

## Declaration

```swift
init(mtlDevice device: any MTLDevice)
```

## Parameters

- `device`: The Metal device object to use for rendering.

## Return Value

Return Value A Core Image context.

## Discussion

Discussion Use this method to choose a specific Metal device for rendering when a system contains multiple Metal devices. To create a Metal-based context using the system’s default Metal device, use the contextWithOptions: method.

## See Also

### Creating a Context for GPU-Based Rendering

- [init(mtlDevice:options:)](coreimage/cicontext/init(mtldevice:options:)-26usb.md)
- [init(mtlCommandQueue:)](coreimage/cicontext/init(mtlcommandqueue:)-7dtqk.md)
- [init(mtlCommandQueue:options:)](coreimage/cicontext/init(mtlcommandqueue:options:)-6i3me.md)
