Skip to content

Commit

Permalink
feat: iOS 13 scene delegate support
Browse files Browse the repository at this point in the history
  • Loading branch information
krzysztofzablocki committed Sep 2, 2020
1 parent 8dd559a commit 6bbd746
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion LifetimeTracker.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "LifetimeTracker"
s.version = "1.7.1"
s.version = "1.8.0"
s.summary = "Framework to visually warn you when retain cycle / leak happens."
s.description = <<-DESC
Mini framework that can surface retain cycle issues sooner.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,16 @@ class CircularDashboardViewController: UIViewController, LifetimeTrackerViewable
}

private lazy var popoverWindow: UIWindow = {
var frame: CGRect = UIScreen.main.bounds
let popoverWindow = UIWindow(frame: .zero)

if #available(iOS 13.0, *), let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene {
frame = windowScene.coordinateSpace.bounds
popoverWindow.windowScene = windowScene
}

popoverWindow.windowLevel = UIWindow.Level.normal
popoverWindow.frame = UIScreen.main.bounds
popoverWindow.frame = frame

let navigationController = UIStoryboard(name: Constants.Storyboard.circularDashboard.name, bundle: Bundle(for: CircularDashboardViewController.self)).instantiateInitialViewController()
popoverWindow.rootViewController = navigationController
Expand Down
9 changes: 8 additions & 1 deletion Sources/iOS/UI/LifetimeTracker+DashboardView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,16 @@ typealias GroupModel = (color: UIColor, title: String, groupName: String, groupC
}()

private lazy var window: UIWindow = {
var frame: CGRect = UIScreen.main.bounds
let window = UIWindow(frame: .zero)

if #available(iOS 13.0, *), let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene {
frame = windowScene.coordinateSpace.bounds
window.windowScene = windowScene
}

window.windowLevel = UIWindow.Level.statusBar
window.frame = UIScreen.main.bounds
window.frame = frame
window.rootViewController = self.lifetimeTrackerView
return window
}()
Expand Down

0 comments on commit 6bbd746

Please sign in to comment.