<!--
{
  "availability" : [
    "iOS: 8.0.0 - 26.0.0",
    "iPadOS: 8.0.0 - 26.0.0",
    "macCatalyst: 13.1.0 - 26.0.0",
    "macOS: 10.8.0 - 26.0.0",
    "tvOS: 9.0.0 - 26.0.0",
    "visionOS: 1.0.0 - 26.0.0",
    "watchOS: 3.0.0 - 26.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "SceneKit",
  "identifier" : "/documentation/SceneKit/SCNGeometryElement/init(data:primitiveType:primitiveCount:bytesPerIndex:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SceneKit"
    ],
    "preciseIdentifier" : "c:objc(cs)SCNGeometryElement(cm)geometryElementWithData:primitiveType:primitiveCount:bytesPerIndex:"
  },
  "title" : "init(data:primitiveType:primitiveCount:bytesPerIndex:)"
}
-->

# init(data:primitiveType:primitiveCount:bytesPerIndex:)

Creates a geometry element from the specified data and options.

```
convenience init(data: Data?, primitiveType: SCNGeometryPrimitiveType, primitiveCount: Int, bytesPerIndex: Int)
```

## Parameters

`data`

The data describing the element.

`primitiveType`

The drawing primitive that connects vertices when rendering the geometry element. For possible values, see [`SCNGeometryPrimitiveType`](/documentation/SceneKit/SCNGeometryPrimitiveType).

`primitiveCount`

The number of primitives in the element.

`bytesPerIndex`

The number of bytes that represent a single index value in the data.

## Return Value

A new geometry element object.

## Discussion

An element’s data is an array of index values identifying vertices in a geometry source. SceneKit interprets the data as an array of unsigned integers (whose size is specified by the `bytesPerIndex` parameter), and then connects the vertices in the order specified by this array, arranged according to the `primitiveType` parameter.

To create a custom [`SCNGeometry`](/documentation/SceneKit/SCNGeometry) object from the geometry element, use the [`init(sources:elements:)`](/documentation/SceneKit/SCNGeometry/init(sources:elements:)) method.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)