diff --git a/Sources/LocalConsole/LCManager.swift b/Sources/LocalConsole/LCManager.swift index bfa8e8d..9522fc3 100644 --- a/Sources/LocalConsole/LCManager.swift +++ b/Sources/LocalConsole/LCManager.swift @@ -136,11 +136,7 @@ public class LCManager: NSObject, UIGestureRecognizerDelegate { } } - /// Strong reference keeps the window alive. - var consoleWindow: ConsoleWindow? - - /// Enables rotation. - lazy var viewController = ConsoleViewController() + lazy var consoleViewController = ConsoleViewController() /// Note: The console always needs a parent view controller in order to display context menus. In this case, the parent controller will be the viewController. lazy var consoleView = UIView() @@ -162,15 +158,13 @@ public class LCManager: NSObject, UIGestureRecognizerDelegate { /// Gesture endpoints. Each point represents a corner of the screen. TODO: Handle screen rotation. var possibleEndpoints: [CGPoint] { - guard let consoleWindow = consoleWindow else { return [] } - - let screenSize = viewController.view.frame.size + let screenSize = consoleViewController.view.frame.size // Must check for portrait mode manually here. UIDevice was reporting orientation incorrectly before. - let isPortraitNotchedPhone = UIDevice.current.hasNotch && viewController.view.frame.size.width < viewController.view.frame.size.height + let isPortraitNotchedPhone = UIDevice.current.hasNotch && consoleViewController.view.frame.size.width < consoleViewController.view.frame.size.height // Fix incorrect reported orientation on phone. - let isLandscapePhone = UIDevice.current.userInterfaceIdiom == .phone && viewController.view.frame.width > viewController.view.frame.height + let isLandscapePhone = UIDevice.current.userInterfaceIdiom == .phone && consoleViewController.view.frame.width > consoleViewController.view.frame.height let isLandscapeLeftNotchedPhone = UIDevice.current.orientation == .landscapeLeft && UIDevice.current.userInterfaceIdiom == .phone @@ -182,10 +176,12 @@ public class LCManager: NSObject, UIGestureRecognizerDelegate { && UIDevice.current.hasNotch && isLandscapePhone - let leftEndpointX = consoleSize.width / 2 + consoleWindow.safeAreaInsets.left + (isLandscapePhone ? 4 : 12) + (isLandscapeRightNotchedPhone ? -16 : 0) - let rightEndpointX = screenSize.width - (consoleSize.width / 2 + consoleWindow.safeAreaInsets.right) - (isLandscapePhone ? 4 : 12) + (isLandscapeLeftNotchedPhone ? 16 : 0) - let topEndpointY = consoleSize.height / 2 + consoleWindow.safeAreaInsets.top + 12 + (isPortraitNotchedPhone ? -10 : 0) - let bottomEndpointY = screenSize.height - consoleSize.height / 2 - (keyboardHeight ?? consoleWindow.safeAreaInsets.bottom) - 12 + (isLandscapePhone ? 10 : 0) + let safeAreaInsets = consoleViewController.view.safeAreaInsets + + let leftEndpointX = consoleSize.width / 2 + safeAreaInsets.left + (isLandscapePhone ? 4 : 12) + (isLandscapeRightNotchedPhone ? -16 : 0) + let rightEndpointX = screenSize.width - (consoleSize.width / 2 + safeAreaInsets.right) - (isLandscapePhone ? 4 : 12) + (isLandscapeLeftNotchedPhone ? 16 : 0) + let topEndpointY = consoleSize.height / 2 + safeAreaInsets.top + 12 + (isPortraitNotchedPhone ? -10 : 0) + let bottomEndpointY = screenSize.height - consoleSize.height / 2 - (keyboardHeight ?? safeAreaInsets.bottom) - 12 + (isLandscapePhone ? 10 : 0) if consoleSize.width < screenSize.width - 112 { // Four endpoints, one for each corner. @@ -357,15 +353,15 @@ public class LCManager: NSObject, UIGestureRecognizerDelegate { NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow), name: UIResponder.keyboardWillShowNotification, object: nil) } - /// Adds a LocalConsole window to the app's main scene. - func configureWindow() { + /// Adds a consoleViewController to the app's main window. + func configureConsoleViewController() { var windowSceneFound = false // Update console cached based on last-cached origin. func updateConsoleOrigin() { snapToCachedEndpoint() - if consoleView.center.x < 0 || consoleView.center.x > viewController.view.frame.size.width { + if consoleView.center.x < 0 || consoleView.center.x > consoleViewController.view.frame.size.width { grabberMode = true scrollLocked = !grabberMode @@ -383,22 +379,17 @@ public class LCManager: NSObject, UIGestureRecognizerDelegate { .filter { $0.activationState == .foregroundActive } .first - if let windowScene = windowScene as? UIWindowScene { + if let windowScene = windowScene as? UIWindowScene, let keyWindow = windowScene.keyWindow { windowSceneFound = true - UIWindow.swizzleStatusBarAppearanceOverride() SwizzleTool().swizzleContextMenuReverseOrder() - consoleWindow = ConsoleWindow(windowScene: windowScene) - consoleWindow?.frame = UIScreen.main.bounds - consoleWindow?.windowLevel = UIWindow.Level.statusBar - consoleWindow?.isHidden = false + consoleViewController.view = PassthroughView() + consoleViewController.view.addSubview(consoleView) - viewController.view = PassthroughView() - - consoleWindow?.rootViewController = viewController - - viewController.view.addSubview(consoleView) + keyWindow.addSubview(consoleViewController.view) + consoleViewController.view.frame = keyWindow.bounds + consoleViewController.view.autoresizingMask = [.flexibleWidth, .flexibleHeight] updateConsoleOrigin() } @@ -406,7 +397,6 @@ public class LCManager: NSObject, UIGestureRecognizerDelegate { /// Ensures the window is configured (i.e. scene has been found). If not, delay and wait for a scene to prepare itself, then try again. for i in 1...10 { - let delay = Double(i) / 10 DispatchQueue.main.asyncAfter(deadline: .now() + delay) { [self] in @@ -442,7 +432,7 @@ public class LCManager: NSObject, UIGestureRecognizerDelegate { if !isConsoleConfigured { DispatchQueue.main.async { [self] in - configureWindow() + configureConsoleViewController() configureConsole() isConsoleConfigured = true } @@ -532,6 +522,60 @@ public class LCManager: NSObject, UIGestureRecognizerDelegate { } } + @objc func handleDeviceOrientationChange(previousSize: CGSize) { + + // Cancel the panner console is being panned to allow for location manipulation. + [LCManager.shared.panRecognizer, LCManager.shared.longPressRecognizer].forEach { + $0.isEnabled.toggle(); $0.isEnabled.toggle() + } + + if UIDevice.current.userInterfaceIdiom != .pad && ResizeController.shared.isActive { + ResizeController.shared.isActive = false + ResizeController.shared.platterView.dismiss() + } + + if UIDevice.current.userInterfaceIdiom == .pad && ResizeController.shared.isActive { + DispatchQueue.main.async { + UIViewPropertyAnimator(duration: 0.6, dampingRatio: 1) { + LCManager.shared.consoleView.center = ResizeController.shared.consoleCenterPoint + }.startAnimation(afterDelay: 0.05) + } + } else { + let consoleView = LCManager.shared.consoleView + + let targetLocationEstimate: CGPoint = { + var xPosition = consoleView.center.x + var yPosition = consoleView.center.y + + if consoleView.center.x > previousSize.width / 2 { + xPosition += consoleViewController.view.frame.width - previousSize.width + } + + if consoleView.center.y > previousSize.height / 2 { + yPosition += consoleViewController.view.frame.height - previousSize.height + } + + return CGPoint(x: xPosition, y: yPosition) + }() + + UIViewPropertyAnimator(duration: 0.6, dampingRatio: 1) { + consoleView.center = targetLocationEstimate + }.startAnimation(afterDelay: 0.05) + + DispatchQueue.main.async { + // Update portrait orientation menu option for resize controller. + LCManager.shared.menuButton.menu = LCManager.shared.makeMenu() + + // Reassess center of console based on target location estimate. + UIViewPropertyAnimator(duration: 0.6, dampingRatio: 1) { + consoleView.center = nearestTargetTo(consoleView.center, possibleTargets: LCManager.shared.possibleEndpoints) + }.startAnimation(afterDelay: 0.05) + + LCManager.shared.reassessGrabberMode() + } + } + } + var hasShortened = false public var isCharacterLimitDisabled = false @@ -649,7 +693,7 @@ public class LCManager: NSObject, UIGestureRecognizerDelegate { if currentText != "" { print("\n") } - dynamicReportTimer = Timer.scheduledTimer(withTimeInterval: 1, repeats: true) { timer in + dynamicReportTimer = Timer.scheduledTimer(withTimeInterval: 1, repeats: true) { [self] timer in guard consoleTextView.panGestureRecognizer.numberOfTouches == 0 else { return } @@ -714,7 +758,7 @@ public class LCManager: NSObject, UIGestureRecognizerDelegate { if currentText != "" { print("\n") } - let safeAreaInsets = consoleWindow?.safeAreaInsets ?? .zero + let safeAreaInsets = consoleViewController.view.safeAreaInsets ?? .zero print( """ @@ -769,36 +813,32 @@ public class LCManager: NSObject, UIGestureRecognizerDelegate { public var showAllUserDefaultsKeys = false func makeMenu() -> UIMenu { + let share = UIAction(title: "Share Text...", image: UIImage(systemName: "square.and.arrow.up")) { _ in + let activityViewController = UIActivityViewController( + activityItems: [self.consoleTextView.text ?? ""], + applicationActivities: nil + ) + self.consoleViewController.present(activityViewController, animated: true) + } - let share = UIAction(title: "Share Text...", - image: UIImage(systemName: "square.and.arrow.up"), handler: { _ in - let activityViewController = UIActivityViewController(activityItems: [self.consoleTextView.text ?? ""], - applicationActivities: nil) - self.viewController.present(activityViewController, animated: true) - }) - - let resize = UIAction(title: "Resize Console", - image: UIImage(systemName: "arrow.left.and.right.square"), handler: { _ in + let resize = UIAction(title: "Resize Console", image: UIImage(systemName: "arrow.up.backward.and.arrow.down.forward")) { _ in DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { ResizeController.shared.isActive.toggle() ResizeController.shared.platterView.reveal() } - }) + } // If device is phone in landscape, disable resize controller. - if UIDevice.current.userInterfaceIdiom == .phone && viewController.view.frame.width > viewController.view.frame.height { + if UIDevice.current.userInterfaceIdiom == .phone && consoleViewController.view.frame.width > consoleViewController.view.frame.height { resize.attributes = .disabled if #available(iOS 15, *) { resize.subtitle = "Portrait Orientation Only" } } - let clear = UIAction(title: "Clear Console", - image: UIImage(systemName: "xmark.square"), handler: { _ in + let clear = UIAction(title: "Clear Console", image: UIImage(systemName: "delete.backward"), attributes: .destructive) { _ in self.clear() - }) - - let consoleActions = UIMenu(title: "", options: .displayInline, children: [clear, resize]) + } var frameSymbol = "rectangle.3.offgrid" @@ -893,7 +933,7 @@ public class LCManager: NSObject, UIGestureRecognizerDelegate { alertController.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: { _ in })) - self.viewController.present(alertController, + self.consoleViewController.present(alertController, animated: true) } action.subtitle = "\(value)" @@ -922,16 +962,17 @@ public class LCManager: NSObject, UIGestureRecognizerDelegate { } - let viewFrames = UIAction(title: debugBordersEnabled ? "Hide View Frames" : "Show View Frames", - image: UIImage(systemName: frameSymbol), handler: { _ in + let viewFrames = UIAction( + title: debugBordersEnabled ? "Hide View Frames" : "Show View Frames", + image: UIImage(systemName: frameSymbol) + ) { _ in self.debugBordersEnabled.toggle() self.menuButton.menu = self.makeMenu() - }) + } - let systemReport = UIAction(title: "System Report", - image: UIImage(systemName: "cpu"), handler: { _ in + let systemReport = UIAction(title: "System Report", image: UIImage(systemName: "cpu")) { _ in self.systemReport() - }) + } // Show the right glyph for the current device being used. let deviceSymbol: String = { @@ -955,13 +996,15 @@ public class LCManager: NSObject, UIGestureRecognizerDelegate { } }() - let displayReport = UIAction(title: "Display Report", - image: UIImage(systemName: deviceSymbol), handler: { _ in + let displayReport = UIAction(title: "Display Report", image: UIImage(systemName: deviceSymbol)) { _ in self.displayReport() - }) + } - let respring = UIAction(title: "Restart Spring" + "Board", - image: UIImage(systemName: "apps.iphone"), handler: { _ in + let terminateApplication = UIAction(title: "Terminate App", image: UIImage(systemName: "xmark"), attributes: .destructive) { _ in + UIApplication.shared.perform(NSSelectorFromString("terminateWithSuccess")) + } + + let respring = UIAction(title: "Restart Spring" + "Board", image: UIImage(systemName: "arrowtriangle.backward"), attributes: .destructive) { _ in guard let window = UIApplication.shared.windows.first else { return } @@ -977,28 +1020,36 @@ public class LCManager: NSObject, UIGestureRecognizerDelegate { for _ in 0...1000 { DispatchQueue.global(qos: .default).async { - // This will cause jetsam to terminate SpringBoard. + // This will cause jetsam to terminate backboardd. while true { window.snapshotView(afterScreenUpdates: false) } } } - }) + } - debugActions.append(contentsOf: [viewFrames, systemReport, displayReport, respring]) + debugActions.append(contentsOf: [viewFrames, systemReport, displayReport]) + let destructActions = [terminateApplication , respring] - let debugMenu = UIMenu(title: "", options: .displayInline, - children: [UIMenu(title: "Debug", image: UIImage(systemName: "ant"), - children: debugActions)]) + let debugMenu = UIMenu( + title: "Debug", image: UIImage(systemName: "ant"), + children: [ + UIMenu(title: "", options: .displayInline, children: debugActions), + UIMenu(title: "", options: .displayInline, children: destructActions), + ] + ) var menuContent: [UIMenuElement] = [] if consoleTextView.text != "" { - menuContent.append(contentsOf: [share, consoleActions]) + menuContent.append(contentsOf: [UIMenu(title: "", options: .displayInline, children: [share, resize])]) } else { - menuContent.append(resize) + menuContent.append(UIMenu(title: "", options: .displayInline, children: [resize])) } menuContent.append(debugMenu) + if consoleTextView.text != "" { + menuContent.append(UIMenu(title: "", options: .displayInline, children: [clear])) + } return UIMenu(title: "", children: menuContent) } @@ -1117,7 +1168,7 @@ public class LCManager: NSObject, UIGestureRecognizerDelegate { } func reassessGrabberMode() { - if consoleView.frame.maxX > 30 && consoleView.frame.minX < viewController.view.frame.size.width - 30 { + if consoleView.frame.maxX > 30 && consoleView.frame.minX < consoleViewController.view.frame.size.width - 30 { grabberMode = false } else { grabberMode = true @@ -1176,22 +1227,14 @@ public class LCManager: NSObject, UIGestureRecognizerDelegate { } } -// Custom window for the console to appear above other windows while passing touches down. -class ConsoleWindow: UIWindow { +// Custom view that is passes touches . +class PassthroughView: UIView { override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? { - if let hitView = super.hitTest(point, with: event) { - if hitView.isKind(of: PassthroughView.self) { - return nil - } - return hitView - } - return super.hitTest(point, with: event) + let hitView = super.hitTest(point, with: event) + return hitView == self ? nil : hitView } } -// Custom view that is passed through if it is the returned hitTest for ConsoleWindow. -class PassthroughView: UIView { } - import UIKit.UIGestureRecognizerSubclass public class UITapStartEndGestureRecognizer: UITapGestureRecognizer { @@ -1224,22 +1267,6 @@ extension UIView { } } -extension UIWindow { - - /// Make sure this window does not have control over the status bar appearance. - static func swizzleStatusBarAppearanceOverride() { - guard let originalMethod = class_getInstanceMethod(UIWindow.self, NSSelectorFromString("_can" + "Affect" + "Status" + "Bar" + "Appearance")), - let swizzledMethod = class_getInstanceMethod(UIWindow.self, #selector(swizzled_statusBarAppearance)) - else { return } - - method_exchangeImplementations(originalMethod, swizzledMethod) - } - - @objc func swizzled_statusBarAppearance() -> Bool { - return isKeyWindow - } -} - class SwizzleTool: NSObject { /// Ensure context menus always show in a non reversed order. @@ -1415,60 +1442,16 @@ fileprivate func _debugPrint(_ items: Any) { // Support for auto-rotate. class ConsoleViewController: UIViewController { + var previousSize: CGSize? - override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) { - - // Cancel the panner console is being panned to allow for location manipulation. - [LCManager.shared.panRecognizer, LCManager.shared.longPressRecognizer].forEach { - $0.isEnabled.toggle(); $0.isEnabled.toggle() - } - - if UIDevice.current.userInterfaceIdiom != .pad && ResizeController.shared.isActive { - ResizeController.shared.isActive = false - ResizeController.shared.platterView.dismiss() - } - - if UIDevice.current.userInterfaceIdiom == .pad && ResizeController.shared.isActive { - DispatchQueue.main.async { - UIViewPropertyAnimator(duration: 0.6, dampingRatio: 1) { - LCManager.shared.consoleView.center = ResizeController.shared.consoleCenterPoint - }.startAnimation(afterDelay: 0.05) - } - - } else { - let consoleView = LCManager.shared.consoleView - let oldSize = LCManager.shared.viewController.view.frame.size - - let targetLocationEstimate: CGPoint = { - var xPosition = consoleView.center.x - var yPosition = consoleView.center.y - - if consoleView.center.x > oldSize.width / 2 { - xPosition += size.width - oldSize.width - } - - if consoleView.center.y > oldSize.height / 2 { - yPosition += size.height - oldSize.height - } - - return CGPoint(x: xPosition, y: yPosition) - }() - - UIViewPropertyAnimator(duration: 0.6, dampingRatio: 1) { - consoleView.center = targetLocationEstimate - }.startAnimation(afterDelay: 0.05) - - DispatchQueue.main.async { - // Update portrait orientation menu option for resize controller. - LCManager.shared.menuButton.menu = LCManager.shared.makeMenu() - - // Reassess center of console based on target location estimate. - UIViewPropertyAnimator(duration: 0.6, dampingRatio: 1) { - consoleView.center = nearestTargetTo(consoleView.center, possibleTargets: LCManager.shared.possibleEndpoints) - }.startAnimation(afterDelay: 0.05) - - LCManager.shared.reassessGrabberMode() - } + override func viewWillLayoutSubviews() { + super.viewWillLayoutSubviews() + + if let previousSize = previousSize, previousSize != view.bounds.size { + LCManager.shared.handleDeviceOrientationChange(previousSize: previousSize) + self.previousSize = view.bounds.size + } else if previousSize == nil { + previousSize = view.bounds.size } } } diff --git a/Sources/LocalConsole/ResizeController.swift b/Sources/LocalConsole/ResizeController.swift index 41ae98a..e9faf61 100644 --- a/Sources/LocalConsole/ResizeController.swift +++ b/Sources/LocalConsole/ResizeController.swift @@ -15,7 +15,7 @@ class ResizeController { lazy var platterView = PlatterView(frame: .zero) var consoleCenterPoint: CGPoint { - let containerViewSize = LCManager.shared.viewController.view.frame.size + let containerViewSize = LCManager.shared.consoleViewController.view.frame.size return CGPoint(x: (containerViewSize.width * UIScreen.main.scale / 2).rounded() / UIScreen.main.scale, y: (containerViewSize.height * UIScreen.main.scale / 2).rounded() / UIScreen.main.scale @@ -50,7 +50,7 @@ class ResizeController { lazy var bottomGrabber: UIView = { let view = UIView() - LCManager.shared.consoleWindow?.addSubview(view) + LCManager.shared.consoleViewController.view.addSubview(view) view.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ @@ -80,7 +80,7 @@ class ResizeController { lazy var rightGrabber: UIView = { let view = UIView() - LCManager.shared.consoleWindow?.addSubview(view) + LCManager.shared.consoleViewController.view.addSubview(view) view.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ @@ -117,7 +117,7 @@ class ResizeController { _ = rightGrabber // Ensure initial autolayout is performed unanimated. - LCManager.shared.consoleWindow?.layoutIfNeeded() + LCManager.shared.consoleViewController.view.layoutIfNeeded() if #available(iOS 15, *) { FrameRateRequest.shared.perform(duration: 1.5) @@ -138,17 +138,17 @@ class ResizeController { } // Ensure background color animates in right the first time. - LCManager.shared.consoleWindow?.backgroundColor = .clear + LCManager.shared.consoleViewController.view.backgroundColor = .clear UIViewPropertyAnimator(duration: 0.6, dampingRatio: 1) { LCManager.shared.consoleView.center = self.consoleCenterPoint // Update grabbers (layout constraints) - LCManager.shared.consoleWindow?.layoutIfNeeded() + LCManager.shared.consoleViewController.view.layoutIfNeeded() LCManager.shared.menuButton.alpha = 0 - LCManager.shared.consoleWindow?.backgroundColor = UIColor(dynamicProvider: { traitCollection in + LCManager.shared.consoleViewController.view.backgroundColor = UIColor(dynamicProvider: { traitCollection in UIColor(white: 0, alpha: traitCollection.userInterfaceStyle == .light ? 0.1 : 0.3) }) }.startAnimation() @@ -181,11 +181,11 @@ class ResizeController { LCManager.shared.snapToCachedEndpoint() // Update grabbers (layout constraints) - LCManager.shared.consoleWindow?.layoutIfNeeded() + LCManager.shared.consoleViewController.view.layoutIfNeeded() LCManager.shared.menuButton.alpha = 1 - LCManager.shared.consoleWindow?.backgroundColor = .clear + LCManager.shared.consoleViewController.view.backgroundColor = .clear }.startAnimation() UIViewPropertyAnimator(duration: 0.2, dampingRatio: 1) { [self] in @@ -277,7 +277,7 @@ class ResizeController { LCManager.shared.consoleView.center.y = self.consoleCenterPoint.y // Animate autolayout updates. - LCManager.shared.consoleWindow?.layoutIfNeeded() + LCManager.shared.consoleViewController.view.layoutIfNeeded() }.startAnimation() UIViewPropertyAnimator(duration: 0.4, dampingRatio: 1) { [self] in @@ -358,7 +358,7 @@ class ResizeController { LCManager.shared.consoleView.center.x = (UIScreen.main.nativeBounds.width * 1/2).rounded() / UIScreen.main.scale // Animate autolayout updates. - LCManager.shared.consoleWindow?.layoutIfNeeded() + LCManager.shared.consoleViewController.view.layoutIfNeeded() }.startAnimation() UIViewPropertyAnimator(duration: 0.4, dampingRatio: 1) { [self] in @@ -396,8 +396,8 @@ class PlatterView: UIView { addSubview(blurView) - LCManager.shared.viewController.view.addSubview(self) - LCManager.shared.viewController.view.sendSubviewToBack(self) + LCManager.shared.consoleViewController.view.addSubview(self) + LCManager.shared.consoleViewController.view.sendSubviewToBack(self) _ = backgroundButton @@ -466,8 +466,8 @@ class PlatterView: UIView { self.dismiss() })) backgroundButton.frame.size = CGSize(width: self.frame.size.width, height: possibleEndpoints[0].y + 30) - LCManager.shared.consoleWindow?.addSubview(backgroundButton) - LCManager.shared.consoleWindow?.sendSubviewToBack(backgroundButton) + LCManager.shared.consoleViewController.view.addSubview(backgroundButton) + LCManager.shared.consoleViewController.view.sendSubviewToBack(backgroundButton) return backgroundButton }() @@ -525,7 +525,7 @@ class PlatterView: UIView { LCManager.shared.consoleSize = LCManager.shared.defaultConsoleSize LCManager.shared.lumaHeightAnchor.constant = LCManager.shared.defaultConsoleSize.height LCManager.shared.consoleView.center = ResizeController.shared.consoleCenterPoint - LCManager.shared.consoleWindow?.layoutIfNeeded() + LCManager.shared.consoleViewController.view.layoutIfNeeded() }.startAnimation() }), for: .touchUpInside) @@ -544,7 +544,7 @@ class PlatterView: UIView { }() func configureFrame() { - self.frame.size = LCManager.shared.viewController.view.frame.size + self.frame.size = LCManager.shared.consoleViewController.view.frame.size // Make sure bottom doesn't show on upwards pan. self.frame.size.height += 50 self.frame.origin = possibleEndpoints[1] @@ -593,7 +593,7 @@ class PlatterView: UIView { } var possibleEndpoints: [CGPoint] { return [CGPoint(x: 0, y: (UIScreen.hasRoundedCorners ? 44 : -8) + 63), - CGPoint(x: 0, y: LCManager.shared.viewController.view.frame.size.height + 5)] + CGPoint(x: 0, y: LCManager.shared.consoleViewController.view.frame.size.height + 5)] } var initialPlatterOriginY = CGFloat.zero