如何在 swift 中更新 UIView

How to update UIView in swift

我在视图中有一个 UISwitch。我有另一个线程来检测值 A。 我想更新视图以将 UISwitch 设置为真或假取决于值 A 是真还是假。

如何更新 UIView 以实时更改 UISwitch?谢谢。

考虑一下:

dispatch_async(dispatch_get_main_queue()){
    self.switchControl.on = aValue
}