Last active
May 17, 2024 11:58
-
-
Save mccaffers/5c55cd489dda409d3546389a61a410bc to your computer and use it in GitHub Desktop.
SwiftUI - Dismiss multiple sheets (modals) at once
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Swiftui Tricks | |
// Dimiss multiple sheets | |
if let firstScene = UIApplication.shared.connectedScenes.first as? UIWindowScene { | |
if let firstWindow = firstScene.windows.first { | |
let viewController = firstWindow.rootViewController | |
viewController?.dismiss(animated: true) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment