<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLNewLibraryCompletionHandler",
  "metadataVersion" : "0.1.0",
  "role" : "Type Alias",
  "symbol" : {
    "kind" : "Type Alias",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:@T@MTLNewLibraryCompletionHandler"
  },
  "title" : "MTLNewLibraryCompletionHandler"
}
-->

# MTLNewLibraryCompletionHandler

A completion handler signature a method calls when it finishes creating a Metal library.

```
typealias MTLNewLibraryCompletionHandler = ((any MTLLibrary)?, (any Error)?) -> Void
```

## Parameters

`library`

An [`MTLLibrary`](/documentation/Metal/MTLLibrary) instance if the method successfully compiles the library without any errors; otherwise `nil`.

`error`

An error instance if the compiler generates any errors; otherwise `nil`.

## Discussion

The framework reports compiler warnings to the console.
The `error` parameter doesn’t report warnings because it’s `nil` when there aren’t any compiler errors.

---

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)