Skip to content

Instantly share code, notes, and snippets.

@beliy
Created April 7, 2020 10:42
Show Gist options
  • Save beliy/18c445da300142889db08b26a7d0c94f to your computer and use it in GitHub Desktop.
Save beliy/18c445da300142889db08b26a7d0c94f to your computer and use it in GitHub Desktop.
private func rewind() {
let window = UIApplication.shared.connectedScenes
.filter { $0.activationState == .foregroundActive }
.compactMap { $0 as? UIWindowScene }
.compactMap { $0.delegate as? SceneDelegate }
.compactMap { $0.window }.first
let navigationController = window?.rootViewController?.children.first?.children.first as? UINavigationController
navigationController?.popToRootViewController(animated: true)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment