utmapp / utmapp/UTM

Fix potential races with SwiftUI and custom `objectWillChange`

Open
#3,651 0 comments 0 reactions 0 assignees View on GitHub
interface
Dominant language
Swift
Stars
35.5k
Forks
1.8k
Avg merge
5d 5h
Merged PRs (30d)
7

Description

In our Swift extensions to UTMQemuConfiguration and UTMViewState, we use

```swift
func propertyWillChange() -> Void {
if #available(iOS 13, macOS 11, *) {
DispatchQueue.main.async { self.objectWillChange.send() }
}
}
```

To interact with SwiftUI. This `async` silences warnings about modifying a value outside of the main thread but does not solve any race that could result from it. For now, it "just works" but it could lead to more subtle UI bugs.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.