We found this issue on certain iPhones running iOS 16 and in the end we realised we had a function written like so:
// Bad code!
fun doButtonAction() {
DispatchQueue.main.async { [weak self] in
self?.sheetItem = .none
}
}
// SwiftUI View below
Button {
doButtonAction()
} label : {
Text("Press me!")
}
And what fixed it for us was:
@MainActor fun doButtonAction() {
sheetItem = .none
}