Creates a library object asynchronously by compiling the functions stored in the specified source string.
Required.
SDKs
- iOS 8.0+
- macOS 10.11+
- Mac Catalyst 13.0+
- tvOS 9.0+
Framework
- Metal
Declaration
- (void)newLibraryWithSource:(NSString *)source options:(MTLCompile Options *)options completionHandler:(MTLNew Library Completion Handler)completionHandler;
Parameters
source
A string containing source code for one or more Metal functions. See Metal Shading Language Guide.
options
A set of options to influence the compilation of this source code. See
MTLCompile
.Options completionHandler
A block of code that is invoked when the library has completed loading.
Discussion
The source may only import the Metal standard library. There is no search path to find other functions.