给出以下示例代码:
struct ActivityIndicatorView : UIViewRepresentable {
var style: UIActivityIndicatorView.Style = .medium
func makeUIView(context: UIViewRepresentableContext<ActivityIndicatorView>) -> UIActivityIndicatorView {
return UIActivityIndicatorView(style: style)
}
func updateUIView(_ uiView: UIActivityIndicatorView, context: UIViewRepresentableContext<ActivityIndicatorView>) {
uiView.color = UIColor.white // how would I set this to the current .foregroundColor value?
}
}
Run Code Online (Sandbox Code Playgroud)
我如何找出当前值.foregroundColor(…)
以正确呈现我的 UIView?
我已经阅读了这个问题,但这是从外部检查 ModifiedContent 的角度来看的,而不是包装的 View。