How to create Text view in SwiftUI?

SwiftUI – Create Text View

To create a Text view in SwiftUI, use struct Text.

Example

In the following code snippet, we create a Text view in the body of ContentView.

ContentView.swift

import SwiftUI

struct ContentView: View {
    var body: some View {
        Text("Hello, world!")
    }
}

Screenshot

Summary

Summarising this SwiftUI Tutorial, we learned how to create a Text view in SwiftUI.