<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLComputePipelineState/functionHandle(function:)-7d523",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTLComputePipelineState(im)functionHandleWithFunction:"
  },
  "title" : "functionHandle(function:)"
}
-->

# functionHandle(function:)

Creates a function handle for a visible function.

```
func functionHandle(function: any MTLFunction) -> (any MTLFunctionHandle)?
```

## Parameters

`function`

An [`MTLFunction`](/documentation/Metal/MTLFunction) instance that represents the visible function to create a handle for.

## Return Value

A handle to the visible function. When this value is `nil`, an error occurred during handle creation.

## Discussion

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)