From fab982bf817e86f8717dc6e46d045edf7e3f87a5 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Tue, 4 Oct 2022 07:26:50 +0200 Subject: [PATCH] Fix UI idiom in debug log --- .../Extensions/DebugLog+Extensions.swift | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/PassepartoutLibrary/Sources/PassepartoutLibrary/Extensions/DebugLog+Extensions.swift b/PassepartoutLibrary/Sources/PassepartoutLibrary/Extensions/DebugLog+Extensions.swift index ad43717b..6c2e8d9a 100644 --- a/PassepartoutLibrary/Sources/PassepartoutLibrary/Extensions/DebugLog+Extensions.swift +++ b/PassepartoutLibrary/Sources/PassepartoutLibrary/Extensions/DebugLog+Extensions.swift @@ -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" + } + } +}