From 10f02d009dc69080d694836530dfc9e8dd4466dc Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Fri, 26 Aug 2022 11:49:18 +1000 Subject: [PATCH] DRY string for `unavailable` `UIApplication.State` --- .../Remote Logging/Crash Logging/ApplicationFacade.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Sources/Remote Logging/Crash Logging/ApplicationFacade.swift b/Sources/Remote Logging/Crash Logging/ApplicationFacade.swift index 574f1d30..1137ba2d 100644 --- a/Sources/Remote Logging/Crash Logging/ApplicationFacade.swift +++ b/Sources/Remote Logging/Crash Logging/ApplicationFacade.swift @@ -25,11 +25,11 @@ final class ApplicationFacade { #if os(iOS) guard Thread.isMainThread else { // UIApplication.applicationState can only be accessed from the main thread. - return "unavailable" + return UIApplication.State.unavailable } return (UIApplication.sharedIfAvailable()?.applicationState.descriptionForEventTag - ?? "unavailable") + ?? UIApplication.State.unavailable) #else @@ -59,6 +59,8 @@ private extension UIApplication.State { return "unknown" } } + + static var unavailable: String { "unavailable" } } #endif