【发布时间】:2020-07-21 20:08:43
【问题描述】:
当我在 UITextViewWrapper 类中设置 textField.textColor = Color.primary 时,会出现此错误。
如何在 UITextViewWrapper 中使用原色?有什么方法可以使用吗?
fileprivate struct UITextViewWrapper: UIViewRepresentable {
typealias UIViewType = UITextView
func makeUIView(context: UIViewRepresentableContext<UITextViewWrapper>) -> UITextView {
let textField = UITextView()
textField.textColor = Color.primary // here give error
return textField
}
}
【问题讨论】:
-
在这里,我想要一个解决方案来获得此解决方案中不可用的原色。如果缺少任何内容,您可以编辑问题。谢谢!
-
@Ashish 我在下面的解决方案中提供了 ios 14 的初始化程序和较低版本的替代方案。