Compare commits

..

21 Commits

Author SHA1 Message Date
Duraid Abdul 2c5d5e018a Fix share sheet crash 2022-12-04 16:19:33 -07:00
Duraid Abdul 6413eb8a81 Add a custom menu to the console’s menu 2022-11-21 23:44:08 -07:00
Duraid Abdul 1dcb6e3a57 Fix build failure 2022-10-16 19:21:53 -06:00
Duraid Abdul bfc3bc4fd2 Updated action icons, removed ConsoleWindow. 2022-10-16 19:09:36 -06:00
Duraid Abdul 74556927be Fix crash when invoking keyboard early 2022-10-15 12:49:16 -06:00
Duraid Abdul fee9e30df9 Fix simulator crash 2022-10-15 12:48:52 -06:00
Duraid Abdul 5e2b5feca4 Fix blocked touches on iPad 2022-10-15 12:48:23 -06:00
Duraid Abdul 3ffdde8904 Fix Xcode 13 build failure 2022-09-20 10:39:18 -06:00
Duraid Abdul 63ebc8ed31 Fix border view frame 2022-09-18 23:39:48 -06:00
Duraid Abdul 64e18b18fc Fix keybaord avoidance 2022-09-18 23:31:00 -06:00
Duraid Abdul 9dcfa5accd iPhone 14 Pro support 2022-09-18 21:05:11 -06:00
Duraid Abdul adbb2d763f Update README.md 2022-05-14 19:15:47 -07:00
Duraid Abdul c08c26f4a7 Update README.md 2022-05-14 19:15:18 -07:00
Duraid Abdul d995119198 Update LCManager.swift 2022-02-01 12:26:52 -08:00
Duraid Abdul b4d7c06432 Update LCManager.swift 2022-01-26 21:02:54 -08:00
Duraid Abdul a7b95a4379 Update LCManager.swift 2022-01-26 02:18:26 -08:00
Duraid Abdul 3efe25f804 Update LCManager.swift 2022-01-25 17:15:30 -08:00
Duraid Abdul 0a3e28b28f Animation Improvements 2022-01-24 23:09:49 -08:00
Duraid Abdul 009fab95be UserDefaults Support
Signed-off-by: Duraid Abdul <duraidabdul@users.noreply.github.com>
2022-01-24 19:06:49 -08:00
Duraid Abdul a1275a7f49 Update LCManager.swift 2022-01-22 00:09:49 -08:00
Duraid Abdul e08d439d2b Various Improvements 2022-01-22 00:06:35 -08:00
3 changed files with 659 additions and 326 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ Welcome to LocalConsole! This Swift Package makes on-device debugging easy with
2. Paste the following into the URL field: https://github.com/duraidabdul/LocalConsole/
3. Once the package dependancy has been added, import LocalConsole and create an easily accessible global instance of ```Console.shared```.
3. Once the package dependancy has been added, import LocalConsole and create an easily accessible global instance of ```LCManager.shared```.
```swift
import LocalConsole
File diff suppressed because it is too large Load Diff
+44 -29
View File
@@ -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,9 +117,11 @@ class ResizeController {
_ = rightGrabber
// Ensure initial autolayout is performed unanimated.
LCManager.shared.consoleWindow?.layoutIfNeeded()
LCManager.shared.consoleViewController.view.layoutIfNeeded()
FrameRateRequest().perform(duration: 1.5)
if #available(iOS 15, *) {
FrameRateRequest.shared.perform(duration: 1.5)
}
if isActive {
@@ -136,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()
@@ -179,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
@@ -207,7 +209,7 @@ class ResizeController {
static let kMinConsoleHeight: CGFloat = 108
static let kMaxConsoleHeight: CGFloat = 346
let verticalPanner_frameRateRequest = FrameRateRequest()
var verticalPanner_frameRateRequestID: UUID?
@objc func verticalPanner(recognizer: UIPanGestureRecognizer) {
@@ -218,7 +220,10 @@ class ResizeController {
switch recognizer.state {
case .began:
verticalPanner_frameRateRequest.isActive = true
if #available(iOS 15, *) {
verticalPanner_frameRateRequestID = UUID()
FrameRateRequest.shared.activate(id: verticalPanner_frameRateRequestID!)
}
initialHeight = LCManager.shared.consoleSize.height
@@ -251,9 +256,13 @@ class ResizeController {
LCManager.shared.consoleView.center.y = consoleCenterPoint.y
case .ended, .cancelled:
verticalPanner_frameRateRequest.isActive = false
FrameRateRequest().perform(duration: 0.4)
if #available(iOS 15, *), let id = verticalPanner_frameRateRequestID {
verticalPanner_frameRateRequestID = nil
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
FrameRateRequest.shared.deactivate(id: id)
}
}
UIViewPropertyAnimator(duration: 0.4, dampingRatio: 0.7) {
if LCManager.shared.consoleSize.height > maxHeight {
@@ -268,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
@@ -284,7 +293,7 @@ class ResizeController {
static let kMinConsoleWidth: CGFloat = 112
static let kMaxConsoleWidth: CGFloat = [UIScreen.portraitSize.width, UIScreen.portraitSize.height].min()! - 56
let horizontalPanner_frameRateRequest = FrameRateRequest()
var horizontalPanner_frameRateRequestID: UUID?
@objc func horizontalPanner(recognizer: UIPanGestureRecognizer) {
@@ -295,7 +304,10 @@ class ResizeController {
switch recognizer.state {
case .began:
horizontalPanner_frameRateRequest.isActive = true
if #available(iOS 15, *) {
horizontalPanner_frameRateRequestID = UUID()
FrameRateRequest.shared.activate(id: horizontalPanner_frameRateRequestID!)
}
initialWidth = LCManager.shared.consoleSize.width
@@ -328,9 +340,12 @@ class ResizeController {
case .ended, .cancelled:
horizontalPanner_frameRateRequest.isActive = false
FrameRateRequest().perform(duration: 0.4)
if #available(iOS 15, *), let id = horizontalPanner_frameRateRequestID {
horizontalPanner_frameRateRequestID = nil
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
FrameRateRequest.shared.deactivate(id: id)
}
}
UIViewPropertyAnimator(duration: 0.4, dampingRatio: 0.7) {
if LCManager.shared.consoleSize.width > maxWidth {
@@ -343,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
@@ -381,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
@@ -451,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
}()
@@ -510,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)
@@ -529,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]
@@ -578,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