Given the following code:
import SwiftUI
struct ContentView: View {
var body: some View {
VStack {
Text("Hello, world!")
.padding()
Text("https://lvmh.com")
.foregroundColor(.black)
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
I'm getting the following result:
Desired outcome
Follow-up question
I'd like to apply the same behavior to the email strings, e.g.:
Text("[email protected]")
Should not be highlighted.
Solution: use Text(verbatim: )
:
import SwiftUI
struct ContentView: View {
var body: some View {
VStack {
Text("Hello, world!")
.padding()
Text(verbatim: "https://lvmh.com")
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
The result looks as follows:
Also solves the problem with the emails: