Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5094ddc710 | |||
| 9b5e0d84ac | |||
| 1620fad461 | |||
| 86d9e18613 | |||
| 832f507ab1 | |||
| 2406568789 | |||
| f57800e8a4 | |||
| e7bc5d221b |
|
Before Width: | Height: | Size: 10 MiB After Width: | Height: | Size: 10 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 11 MiB |
@@ -2,7 +2,10 @@
|
||||
|
||||
Welcome to LocalConsole! This Swift Package makes on-device debugging easy with a convenient PiP-style console that can display items in the same way ```print()``` will in Xcode. This tool can also dynamically display view frames and restart SpringBoard right from your live app.
|
||||
|
||||
<img src="https://github.com/duraidabdul/LocalConsole/blob/main/Demo.gif?raw=true" width="320">
|
||||
<div>
|
||||
<img src="https://github.com/duraidabdul/LocalConsole/blob/main/Additional%20Files/Demo_Pan.gif?raw=true" width="320">
|
||||
<img src="https://github.com/duraidabdul/LocalConsole/blob/main/Additional%20Files/Demo_Resize.gif?raw=true" width="320">
|
||||
</div>
|
||||
|
||||
## **Setup**
|
||||
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
// Copyright © 2021 Duraid Abdul. All rights reserved.
|
||||
//
|
||||
|
||||
#if canImport(UIKit)
|
||||
|
||||
import UIKit
|
||||
|
||||
/// This class handles enabling and disabling debug borders on a specified view.
|
||||
@@ -64,5 +62,3 @@ class BorderManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
// Copyright © 2021 Duraid Abdul. All rights reserved.
|
||||
//
|
||||
|
||||
#if canImport(UIKit)
|
||||
|
||||
import UIKit
|
||||
|
||||
extension UIScreen {
|
||||
@@ -59,5 +57,3 @@ extension UIView {
|
||||
frame.origin.y = (round(frame.origin.y * UIScreen.main.scale)) / UIScreen.main.scale
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
// Copyright © 2021 Duraid Abdul. All rights reserved.
|
||||
//
|
||||
|
||||
#if canImport(UIKit)
|
||||
|
||||
import UIKit
|
||||
|
||||
extension CGPoint {
|
||||
@@ -80,5 +78,3 @@ func nearestTargetTo(_ point: CGPoint, possibleTargets: [CGPoint]) -> CGPoint {
|
||||
}
|
||||
return nearestEndpoint
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,9 +5,10 @@
|
||||
// Copyright © 2021 Duraid Abdul. All rights reserved.
|
||||
//
|
||||
|
||||
#if canImport(UIKit)
|
||||
//#if canImport(UIKit)
|
||||
|
||||
import UIKit
|
||||
import MachO
|
||||
|
||||
var GLOBAL_DEBUG_BORDERS = false
|
||||
var GLOBAL_BORDER_TRACKERS: [BorderManager] = []
|
||||
@@ -57,7 +58,7 @@ public class LCManager: NSObject, UIGestureRecognizerDelegate {
|
||||
/// Button that reveals menu.
|
||||
lazy var menuButton = UIButton()
|
||||
|
||||
/// Tracks whether the PiP console is in text view scroll mode or pan mode.
|
||||
/// Tracks whether the PiP console is in text view scroll mode or pan mode.
|
||||
var scrollLocked = true
|
||||
|
||||
/// Feedback generator for the long press action.
|
||||
@@ -306,6 +307,52 @@ public class LCManager: NSObject, UIGestureRecognizerDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
func systemReport() {
|
||||
print("Screen Scale: \(UIScreen.main.scale)\n")
|
||||
print("Screen Size: \(UIScreen.main.bounds.size)")
|
||||
print("Screen Radius: \(UIScreen.main.value(forKey: "_displayCornerRadius") as! CGFloat)")
|
||||
print("Max Frame Rate: \(UIScreen.main.maximumFramesPerSecond) Hz")
|
||||
print("Low Power Mode: \(ProcessInfo.processInfo.isLowPowerModeEnabled)")
|
||||
print("System Uptime: \(Int(ProcessInfo.processInfo.systemUptime))s")
|
||||
print("OS Version: \(versionString)")
|
||||
print("Thermal State: \(thermalState)")
|
||||
print("Processor Cores: \(Int(ProcessInfo.processInfo.processorCount))")
|
||||
print("Device RAM: \(round(100 * Double(ProcessInfo.processInfo.physicalMemory) * pow(10, -9)) / 100) GB")
|
||||
print("Architecture: \(deviceArchitecture)")
|
||||
print("Model: \(modelIdentifier)")
|
||||
|
||||
}
|
||||
|
||||
var modelIdentifier: String {
|
||||
if let simulatorModelIdentifier = ProcessInfo().environment["SIMULATOR_MODEL_IDENTIFIER"] { return simulatorModelIdentifier }
|
||||
var sysinfo = utsname()
|
||||
uname(&sysinfo) // ignore return value
|
||||
return String(bytes: Data(bytes: &sysinfo.machine, count: Int(_SYS_NAMELEN)), encoding: .ascii)!.trimmingCharacters(in: .controlCharacters)
|
||||
}
|
||||
|
||||
var deviceArchitecture: String {
|
||||
let info = NXGetLocalArchInfo()
|
||||
return String(utf8String: (info?.pointee.description)!) ?? "Unknown"
|
||||
}
|
||||
|
||||
var versionString: String {
|
||||
ProcessInfo.processInfo.operatingSystemVersionString
|
||||
.replacingOccurrences(of: "Build ", with: "")
|
||||
.replacingOccurrences(of: "Version ", with: "")
|
||||
}
|
||||
|
||||
var thermalState: String {
|
||||
let state = ProcessInfo.processInfo.thermalState
|
||||
|
||||
switch state {
|
||||
case .nominal: return "Nominal"
|
||||
case .fair : return "Fair"
|
||||
case .serious : return "Serious"
|
||||
case .critical : return "Critical"
|
||||
default: return "Unknown"
|
||||
}
|
||||
}
|
||||
|
||||
@objc func toggleLock() {
|
||||
scrollLocked.toggle()
|
||||
}
|
||||
@@ -372,6 +419,11 @@ public class LCManager: NSObject, UIGestureRecognizerDelegate {
|
||||
self.menuButton.menu = self.makeMenu()
|
||||
})
|
||||
|
||||
let systemReport = UIAction(title: "System Report",
|
||||
image: UIImage(systemName: "doc.badge.gearshape"), handler: { _ in
|
||||
self.systemReport()
|
||||
})
|
||||
|
||||
let respring = UIAction(title: "Restart SpringBoard",
|
||||
image: UIImage(systemName: "apps.iphone"), handler: { _ in
|
||||
guard let window = UIApplication.shared.windows.first else { return }
|
||||
@@ -390,7 +442,7 @@ public class LCManager: NSObject, UIGestureRecognizerDelegate {
|
||||
}
|
||||
animator.startAnimation()
|
||||
})
|
||||
let debugActions = UIMenu(title: "", options: .displayInline, children: [viewFrames, respring])
|
||||
let debugActions = UIMenu(title: "", options: .displayInline, children: [viewFrames, systemReport, respring])
|
||||
|
||||
var menuContent: [UIMenuElement] = []
|
||||
|
||||
@@ -590,4 +642,4 @@ extension UIWindow {
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
Reference in New Issue
Block a user