Disable email detection in SwiftUI's Text

Viewed 661

The following code

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

Produces this
Hello, World

But the following code

struct ContentView: View {
    var body: some View {
        Text("hello@gmail.com")
            .padding()
    }
}

Produces this
Email

How can I make "hello@gmail.com" appear formatted like "Hello, World!" (no underline, no blue tint, remove link on click)?

1 Answers

You can use the verbatim: form of Text, which will skip the parsing step:

struct ContentView: View {
    var body: some View {
        Text(verbatim: "hello@gmail.com")
            .padding()
    }
}
Related