Instance Method

newLibraryWithFile:error:

Creates a library object containing the functions in a Metal library file at a specified path.

Required.

Declaration

- (id<MTLLibrary>)newLibraryWithFile:(NSString *)filepath error:(NSError * _Nullable *)error;

Parameters

filepath

The full file path to a .metallib file.

error

An error object that describes the problem, or nil if the operation succeeded.

Return Value

A new library object that contains the functions that were compiled into the .metallib file.

Discussion

See Also

Creating Shader Libraries

- newDefaultLibrary

Creates a library object containing the functions in the app’s default Metal library.

Required.

- newDefaultLibraryWithBundle:error:

Creates a library object containing the functions stored in the default Metal library in the specified bundle.

Required.

- newLibraryWithURL:error:

Creates a library object containing the functions in a Metal library file at a specified URL.

Required.

- newLibraryWithData:error:

Creates a library object containing the functions stored in a binary data object created from a precompiled Metal library.

Required.

- newLibraryWithSource:options:completionHandler:

Creates a library object asynchronously by compiling the functions stored in the specified source string.

Required.

- newLibraryWithSource:options:error:

Creates a library object synchronously by compiling the functions stored in the specified source string.

Required.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software