Asynchronously loads image data and creates Metal textures from the specified list of named texture assets in an asset catalog.
SDKs
- iOS 10.0+
- macOS 10.12+
- Mac Catalyst 13.0+
- tvOS 10.0+
Framework
- Metal
Kit
Declaration
func newTextures(names: [String], scaleFactor: CGFloat, bundle: Bundle?, options: [MTKTexture Loader.Option : Any]? = nil, completionHandler: @escaping MTKTexture Loader.Array Callback)
Parameters
names
An array of strings, each the name of a texture in an asset catalog.
scaleFactor
The scale factor of texture to request.
In iOS and tvOS, pass the
contents
value of the view where you plan to display texture content.Scale In macOS, pass the
backing
value of the window where you plan to display texture content.Scale Factor bundle
The resource bundle containing the asset catalog to load textures from.
options
A dictionary describing any additional texture loading steps. See Texture Loading Options.
When using this method, the texture loader ignores the
generate
,Mipmaps SRGB
,cube
, andLayout origin
options.completionHandler
A block called after all assets have been processed. See the
MTKTexture
signature to determine whether each texture has successfully loaded.Loader .Array Callback