Instance Method

newLibraryWithData:error:

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

Required.

Declaration

- (id<MTLLibrary>)newLibraryWithData:(dispatch_data_t)data error:(NSError * _Nullable *)error;

Parameters

data

The data from a precompiled Metal library. For more information, see Creating Libraries During the App Build Process.

error

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

Return Value

A new library object that contains the functions from the metallib file.

Discussion

Use this method if your application manages its own archiving system for libraries—for example, if you have a single file that contains several libraries.

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.

- newLibraryWithFile:error:

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

Required.

- newLibraryWithURL:error:

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

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