How to dismiss all active sheets within an app? I have 2 app modes
switch appMode {
case .locked:
lockedView
case .unlocked:
contentView
}
When app mode change from one state to another and in current state there is some sheet view this sheet doesn't dissapear. Is there some SwiftUI solution?
You can use this line to dismissing all the presented sheets.
UIApplication.shared.windows.first?.rootViewController?.dismiss(animated: true, completion: nil)