Fix UI idiom in debug log

This commit is contained in:
Davide De Rosa 2022-10-04 07:26:50 +02:00
parent 70c56f039f
commit fab982bf81
1 changed files with 19 additions and 1 deletions

View File

@ -38,7 +38,7 @@ extension DebugLog {
#if os(iOS)
let device: UIDevice = .current
osVersion = "\(device.systemName) \(device.systemVersion)"
deviceType = "\(device.model) (\(device.userInterfaceIdiom))"
deviceType = "\(device.model) (\(device.userInterfaceIdiom.debugDescription))"
#else
let os = ProcessInfo().operatingSystemVersion
osVersion = "macOS \(os.majorVersion).\(os.minorVersion).\(os.patchVersion)"
@ -67,3 +67,21 @@ extension DebugLog {
return data
}
}
private extension UIUserInterfaceIdiom {
var debugDescription: String {
switch self {
case .phone:
return "Phone"
case .pad:
return "Pad"
case .mac:
return "Mac"
default:
return "Other"
}
}
}