Tusker/Tusker/Extensions/UIApplication+Scenes.swift

26 lines
519 B
Swift

//
// UIApplication+Scenes.swift
// Tusker
//
// Created by Shadowfacts on 1/7/20.
// Copyright © 2020 Shadowfacts. All rights reserved.
//
import UIKit
extension UIApplication {
var activeScene: UIScene? {
connectedScenes.first { $0.activationState == .foregroundActive }
}
var backgroundScene: UIScene? {
connectedScenes.first { $0.activationState == .background }
}
var activeOrBackgroundScene: UIScene? {
activeScene ?? backgroundScene
}
}