I "fix" this by the save the selection to a temp variable onChange of the @Environment(.scenePhase)
.onChange(of: scenePhase) { phase in
if phase == .background{
tempSelectedId = selectedId
} else {
if phase == .inactive && selectedId == nil{
selectedId = tempSelectedId
print("Restore - scenePhase")
}
}
}
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: