---
title: "init(data:primitiveType:primitiveCount:bytesPerIndex:)"
framework: scenekit
role: symbol
role_heading: Initializer
path: "scenekit/scngeometryelement/init(data:primitivetype:primitivecount:bytesperindex:)"
---

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

Creates a geometry element from the specified data and options.

## Declaration

```swift
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 doc://com.apple.scenekit/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

Return Value A new geometry element object.

## Discussion

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 object from the geometry element, use the init(sources:elements:) method.

## See Also

### Creating a Geometry Element

- [init(indices:primitiveType:)](scenekit/scngeometryelement/init(indices:primitivetype:).md)
