---
title: device
framework: quartzcore
role: symbol
role_heading: Instance Property
path: quartzcore/cametallayer/device
---

# device

The Metal device responsible for the layer’s drawable resources.

## Declaration

```swift
var device: (any MTLDevice)? { get set }
```

## Discussion

Discussion This property determines which device object Metal uses to create its MTLTexture objects. When you retrieve a drawable object and its associated texture, you must render to the texture using the same device object. The default value is nil—you must set the device for a layer before rendering.

## See Also

### Related Documentation

- [Core Animation Programming Guide](apple-archive/documentation/Cocoa/Conceptual/CoreAnimation_guide/Introduction.md)
- [Metal Programming Guide](apple-archive/documentation/Miscellaneous/Conceptual/MetalProgrammingGuide/Introduction.md)

### Configuring the Metal Device

- [preferredDevice](quartzcore/cametallayer/preferreddevice.md)
