Kurdtvs-Live-Kurdish-TV-Kur.../Mastodon/Coordinator/NeedsDependency.swift

29 lines
696 B
Swift
Raw Normal View History

2021-01-27 07:50:13 +01:00
//
// NeedsDependency.swift
// Mastodon
//
// Created by Cirno MainasuK on 2021-1-27.
//
import UIKit
protocol NeedsDependency: AnyObject {
2021-01-27 07:50:13 +01:00
var context: AppContext! { get set }
var coordinator: SceneCoordinator! { get set }
}
extension UISceneSession {
private struct AssociatedKeys {
static var sceneCoordinator = "SceneCoordinator"
}
weak var sceneCoordinator: SceneCoordinator? {
get {
return objc_getAssociatedObject(self, &AssociatedKeys.sceneCoordinator) as? SceneCoordinator
}
set {
objc_setAssociatedObject(self, &AssociatedKeys.sceneCoordinator, newValue, .OBJC_ASSOCIATION_ASSIGN)
}
}
}