【问题标题】:SwiftUI - Value of type 'Text' has no member 'color' ErrorSwiftUI - “文本”类型的值没有成员“颜色”错误
【发布时间】:2020-02-13 03:00:23
【问题描述】:

我在 Swift UI 代码中遇到错误 1)协议类型'Any'不能符合'View',因为只有具体类型才能符合协议 2)'Text'类型的值没有成员'color'

谁能找到解决办法?

【问题讨论】:

  • 请勿发布代码图片。

标签: ios swift swiftui swiftui-list swiftui-form


【解决方案1】:

没有像color() 这样的修饰符。使用foregroundColor()

Text("Hello world")
    .foregroundColor(.red)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-09-02
    • 2020-03-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多