更改文本链接颜色 swiftUI

Ike*_*bal 18 mobile ios swift swiftui

我有以下内容Text()需要降价来显示链接

Text(.init("[Link Example](https://www.google.es/)"))
Run Code Online (Sandbox Code Playgroud)

我的文字示例

有没有办法更改链接的默认颜色设置?

Asp*_*eri 27

可以使用强调色,例如

Text(.init("[Link Example](https://www.google.es/)"))
    .accentColor(.red)
Run Code Online (Sandbox Code Playgroud)


Olu*_*ayo 19

您可以使用该方法来实现这一点,.tint(_:)因为accentColor(_:)根据文档,该方法很快就会被弃用。

Text("[Link Example](https://www.google.es/)")
  .tint(Color.red)
Run Code Online (Sandbox Code Playgroud)