Initializes a named submesh with a specific topology.


init(name: String, indexBuffer: MDLMeshBuffer, indexCount: Int, indexType: MDLIndexBitDepth, geometryType: MDLGeometryType, material: MDLMaterial?, topology: MDLSubmeshTopology?)



A descriptive name for the submesh. This property is not used in rendering, but can be useful in debugging.


An object that provides index data for the submesh.


The number of indices in the index buffer.


The data type of each index in the index buffer.


The type of geometric primitives described by the index buffer.


A description of the intended surface appearance for rendering the submesh.


An object describing the arrangement of geometric primitives in the index buffer.

Return Value

A new submesh object.


Typically, a submesh is imported from an asset file as a member of a MDLMesh object, but you can also use this method to create a submesh programmatically.

Use this method when the index buffer from which you’re creating a submesh does not contain a uniform array of geometric primitives. Pass MDLGeometryType.variableTopology for the geometryType parameter, and provide an MDLSubmeshTopology object for the topology parameter to describe how the points in the index buffer combine to produce the submesh’s shape. Otherwise, this method is equivalent to the init(name:indexBuffer:indexCount:indexType:geometryType:material:) method.

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