<!--
{
  "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/SCNText/init(string:extrusionDepth:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SceneKit"
    ],
    "preciseIdentifier" : "c:objc(cs)SCNText(cm)textWithString:extrusionDepth:"
  },
  "title" : "init(string:extrusionDepth:)"
}
-->

# init(string:extrusionDepth:)

Creates a text geometry from a specified string, extruded with a specified depth.

```
convenience init(string: Any?, extrusionDepth: CGFloat)
```

## Parameters

`string`

An <doc://com.apple.documentation/documentation/Foundation/NSString> or <doc://com.apple.documentation/documentation/Foundation/NSAttributedString> object containing text from which to create the geometry.

`extrusionDepth`

The extent of the text geometry in the Z dimension of its local coordinate space. Specify a depth of `0.0` to create 2D text confined to a plane.

## Return Value

A new text geometry.

## Discussion

In the local coordinate system of the text geometry, the origin corresponds to the lower left corner of the text’s layout rectangle, with the text extending in the x- and y-axis dimensions. (SceneKit computes a layout rectangle automatically, or you can specify one using the [`containerFrame`](/documentation/SceneKit/SCNText/containerFrame) property.) The geometry is centered along its z-axis. For example, if its [`extrusionDepth`](/documentation/SceneKit/SCNText/extrusionDepth) property is `1.0`, the geometry extends from `-0.5` to `0.5` along the z-axis. An extrusion depth of zero creates a flat, one-sided shape—the geometry is confined to the plane whose z-coordinate is `0.0`, and viewable only from its front unless its material’s [`isDoubleSided`](/documentation/SceneKit/SCNMaterial/isDoubleSided) property is <doc://com.apple.documentation/documentation/Swift/true>.

---

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)