---
title: makeCommandAllocator()
framework: metal
role: symbol
role_heading: Instance Method
path: metal/mtldevice/makecommandallocator()
---

# makeCommandAllocator()

Creates a new command allocator.

## Declaration

```swift
func makeCommandAllocator() -> (any MTL4CommandAllocator)?
```

## Mentioned in

Understanding the Metal 4 core API

## Return Value

Return Value A MTL4CommandAllocator instance, or nil if the function failed.
