Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SwiftUI Text iOS15: Email or URL inside Text view render using accent color

When running the following code in iOS15, the color of a URL or email address within the contents uses the accent color instead of the foreground color. How can I override that?

Text("Send a message to [email protected] to request support")
    .foregroundColor(.blue)

How Text view is rendered in iOS15

like image 732
Ecil Avatar asked Dec 01 '25 20:12

Ecil


1 Answers

You can use Text(verbatim:) to render the string as-is, and not automatically create a link from the email.

Text(verbatim: "Send a message to [email protected] to request support")
    .foregroundColor(.blue)

Result:

Text is all blue

You can also set your own accent color, if you want.

Text("Send a message to [email protected] to request support")
    .tint(.green)

Result:

Email is green, rest of text is black

like image 170
aheze Avatar answered Dec 03 '25 08:12

aheze