Created
March 27, 2024 06:35
-
-
Save hishd/7bef9e7bf5af8a1478d89672ac0474b8 to your computer and use it in GitHub Desktop.
Enabling debugging mode on iOS Apps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct AppConfig { | |
static func toggleDebugMode() -> Bool { | |
guard !UserDefaults.standard.isDebuggingEnabled else { | |
return false | |
} | |
enableDebugMode() | |
func enableDebugMode() -> Never { | |
UserDefaults.standard.isDebuggingEnabled = true | |
exit(0) | |
} | |
} | |
} | |
extension UserDefaults { | |
var isDebuggingEnabled: Bool { | |
get { | |
UserDefaults.standard.bool(forKey: "isDebuggingEnabled") | |
} | |
set { | |
UserDefaults.standard.set(newValue, forKey: "isDebuggingEnabled") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment