Skip to content

Commit

Permalink
Merge pull request fmo91#1 from ismetanin/window_access_fix
Browse files Browse the repository at this point in the history
Added public property window to ApplicationService extension
  • Loading branch information
ismetanin authored Sep 2, 2017
2 parents e03cd1e + 53ea914 commit 5ee2dd2
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ import CloudKit
/// It doesn't add more functionalities yet.
public protocol ApplicationService: UIApplicationDelegate {}

extension ApplicationService {
@nonobjc public var window: UIWindow? {
get {
return UIApplication.shared.delegate?.window ?? nil
} set(newValue) {
(UIApplication.shared.delegate as? PluggableApplicationDelegate)?.window = newValue
}
}
}

open class PluggableApplicationDelegate: UIResponder, UIApplicationDelegate {

public var window: UIWindow?
Expand Down

0 comments on commit 5ee2dd2

Please sign in to comment.