From 74383859aeec02e39ea5ed714ce1aae9f6a63497 Mon Sep 17 00:00:00 2001 From: p-x9 <50244599+p-x9@users.noreply.github.com> Date: Mon, 8 Apr 2024 13:29:01 +0900 Subject: [PATCH 1/3] Add simulator detection to device info output for iOS --- src/swift/deviceIOS.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/src/swift/deviceIOS.swift b/src/swift/deviceIOS.swift index 9d29783..77db070 100644 --- a/src/swift/deviceIOS.swift +++ b/src/swift/deviceIOS.swift @@ -6,6 +6,7 @@ func printDeviceInfo() { print("[Device Info]") print("Name: \(currentDevice.name)") print("Model: \(currentDevice.model)") + print("IsSimulator: \(TARGET_OS_SIMULATOR != 0)") print("System Name: \(currentDevice.systemName)") print("System Version: \(currentDevice.systemVersion)") if let identifierForVendor = currentDevice.identifierForVendor { From 6aba125b4e8c3560e7ebf65d093b1756da07e6bc Mon Sep 17 00:00:00 2001 From: p-x9 <50244599+p-x9@users.noreply.github.com> Date: Mon, 8 Apr 2024 13:33:10 +0900 Subject: [PATCH 2/3] Fix indent --- src/swift/deviceIOS.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/swift/deviceIOS.swift b/src/swift/deviceIOS.swift index 77db070..a0027f9 100644 --- a/src/swift/deviceIOS.swift +++ b/src/swift/deviceIOS.swift @@ -6,7 +6,7 @@ func printDeviceInfo() { print("[Device Info]") print("Name: \(currentDevice.name)") print("Model: \(currentDevice.model)") - print("IsSimulator: \(TARGET_OS_SIMULATOR != 0)") + print("IsSimulator: \(TARGET_OS_SIMULATOR != 0)") print("System Name: \(currentDevice.systemName)") print("System Version: \(currentDevice.systemVersion)") if let identifierForVendor = currentDevice.identifierForVendor { From d298538f949eb0d82bef13904d51da7b1189de0c Mon Sep 17 00:00:00 2001 From: p-x9 <50244599+p-x9@users.noreply.github.com> Date: Tue, 9 Apr 2024 00:59:43 +0900 Subject: [PATCH 3/3] Add more device infos --- src/swift/deviceIOS.swift | 9 +++++++++ src/swift/deviceMacOS.swift | 2 ++ 2 files changed, 11 insertions(+) diff --git a/src/swift/deviceIOS.swift b/src/swift/deviceIOS.swift index a0027f9..8e18a5e 100644 --- a/src/swift/deviceIOS.swift +++ b/src/swift/deviceIOS.swift @@ -1,5 +1,12 @@ import UIKit +var screenSize: CGSize { + guard let window = UIApplication.shared.connectedScenes.first as? UIWindowScene else { + return .zero + } + return window.screen.bounds.size +} + func printDeviceInfo() { let currentDevice = UIDevice.current @@ -9,6 +16,8 @@ func printDeviceInfo() { print("IsSimulator: \(TARGET_OS_SIMULATOR != 0)") print("System Name: \(currentDevice.systemName)") print("System Version: \(currentDevice.systemVersion)") + print("Screen: \(screenSize.width) x \(screenSize.height)") + print("Locale: \(Locale.current)") if let identifierForVendor = currentDevice.identifierForVendor { print("Id For Vendor: \(identifierForVendor.uuidString)") } diff --git a/src/swift/deviceMacOS.swift b/src/swift/deviceMacOS.swift index 9118626..7e0a1fb 100644 --- a/src/swift/deviceMacOS.swift +++ b/src/swift/deviceMacOS.swift @@ -19,6 +19,8 @@ func printDeviceInfo() { if let cpu = sysctlByString(key: "machdep.cpu.brand_string") { print("CPU: \(cpu)") } + + print("Locale: \(Locale.current)") } func sysctlByString(key: String) -> String? {