---
title: MTLNewLibraryCompletionHandler
framework: metal
role: symbol
role_heading: Type Alias
path: metal/mtlnewlibrarycompletionhandler
---

# MTLNewLibraryCompletionHandler

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

## Declaration

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

## Parameters

- `library`: An doc://com.apple.metal/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

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.

## See Also

### Creating shader libraries

- [makeDefaultLibrary()](metal/mtldevice/makedefaultlibrary().md)
- [makeDefaultLibrary(bundle:)](metal/mtldevice/makedefaultlibrary(bundle:).md)
- [makeLibrary(URL:)](metal/mtldevice/makelibrary(url:).md)
- [makeLibrary(source:options:)](metal/mtldevice/makelibrary(source:options:).md)
- [makeLibrary(source:options:completionHandler:)](metal/mtldevice/makelibrary(source:options:completionhandler:).md)
- [makeLibrary(stitchedDescriptor:)](metal/mtldevice/makelibrary(stitcheddescriptor:).md)
- [makeLibrary(stitchedDescriptor:completionHandler:)](metal/mtldevice/makelibrary(stitcheddescriptor:completionhandler:).md)
- [makeLibrary(data:)](metal/mtldevice/makelibrary(data:)-7khmh.md)
- [makeLibrary(data:)](metal/mtldevice/makelibrary(data:).md)
- [makeLibrary(filepath:)](metal/mtldevice/makelibrary(filepath:).md)
