---
title: "makeFunction(descriptor:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtllibrary/makefunction(descriptor:)"
---

# makeFunction(descriptor:)

Synchronously creates an object representing a shader function, using the specified descriptor.

## Declaration

```swift
func makeFunction(descriptor: MTLFunctionDescriptor) throws -> any MTLFunction
```

## Parameters

- `descriptor`: The description of the function object to create.

## Return Value

Return Value A new MTLFunction instance if the method finds the function in the library; otherwise Swift throws an error and Objective-C returns nil.

## See Also

### Creating shader function instances

- [makeFunction(name:)](metal/mtllibrary/makefunction(name:).md)
- [makeFunction(name:constantValues:completionHandler:)](metal/mtllibrary/makefunction(name:constantvalues:completionhandler:).md)
- [makeFunction(name:constantValues:)](metal/mtllibrary/makefunction(name:constantvalues:).md)
- [makeFunction(descriptor:completionHandler:)](metal/mtllibrary/makefunction(descriptor:completionhandler:).md)
