Tusker/Tusker/Extensions/UIWindowSceneDelegate+Close...

21 lines
651 B
Swift

//
// UIWindowSceneDelegate+Close.swift
// Tusker
//
// Created by Shadowfacts on 12/12/20.
// Copyright © 2020 Shadowfacts. All rights reserved.
//
import UIKit
extension UIWindowSceneDelegate {
func closeWindow(animation: UIWindowScene.DismissalAnimation = .standard, errorHandler: ((Error) -> Void)? = nil) {
guard let session = self.window??.windowScene?.session else { return }
let options = UIWindowSceneDestructionRequestOptions()
options.windowDismissalAnimation = animation
UIApplication.shared.requestSceneSessionDestruction(session, options: options, errorHandler: errorHandler)
}
}