这是我的链接:
Link("Terms + Conditions", destination: URL(string: "https://my.app/terms_and_conditions.html")!)
我知道Text()
有一个underline()
修饰符,但是似乎没有一个适用于Link()
的。
有任何想法吗?
Link有一个带有标签参数的初始化器:
init(destination: URL, label: () -> Label)
因此,对于您的示例,您需要设置一个Text("Terms + Conditions")
视图作为标签,并在文本视图上使用.underline()
修饰符以获得预期结果。
以苹果公司的网站为例:
Link(destination: URL(string: "https://www.apple.com")!, label: {
Text("Apple")
.underline()
})