<!--
{
  "availability" : [
    "Xcode: 16.0.0 -",
    "visionOS: 2.0.0 -"
  ],
  "documentType" : "article",
  "framework" : "visionOS",
  "identifier" : "/documentation/visionOS/displaying-text-in-visionOS",
  "metadataVersion" : "0.1.0",
  "role" : "sampleCode",
  "title" : "Displaying text in visionOS"
}
-->

# Displaying text in visionOS

Create styled text in a window using SwiftUI.

## Overview

This sample app uses SwiftUI views to display text in four distinct styles:

- Large title
- Subheadline
- Bold
- Regular with color

The following image shows how the scene renders in visionOS:

![A screenshot of a visionOS app in Simulator, displaying a translucent window with four lines of center-aligned text in a vertical arrangement. From top to bottom, the lines exhibit the following styles: large title, subheadline, bold, and regular with a green color.](images/com.apple.visionOS/sample-text-1-main-view.png)

The app’s main view displays four lines of text by creating a
<doc://com.apple.documentation/documentation/SwiftUI/Text> instance for each line:

```swift
struct SwiftUIText: View {
    /// The amount of spacing between each text entry.
    let spacing: CGFloat = 30

    var body: some View {
        VStack(spacing: spacing) {
            // Set the style to large title.
            Text("This is a large title").font(.largeTitle)

            // Set the style to subheadline.
            Text("This is a subheadline text").font(.subheadline)

            // Format the text to bold.
            Text("This is a bold text").fontWeight(.bold)

            // Set the text's color to green.
            Text("This is a green text").foregroundStyle(.green)
        }
    }
}
```

SwiftUI provides the `Text` view and its modifiers, which the app uses to make each text appear unique.

---

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)