Contents

makeLibrary(data:)

Creates a Metal library instance from a dispatch-data instance that contains the functions in a precompiled Metal library.

Declaration

func makeLibrary(data: dispatch_data_t) throws -> any MTLLibrary

Parameters

Return Value

A new MTLLibrary instance if the method completes successfully; otherwise Swift throws an error and Objective-C returns nil.

Discussion

In Swift, you can also use the makeLibrary(data:) default implementation, which has a DispatchData parameter.

Use either method if your application manages its own archiving system for libraries — for example, if your app uses a single file that contains several libraries.

See Also

Creating shader libraries