Skip to content

Instantly share code, notes, and snippets.

@hishd
Created March 27, 2024 06:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hishd/7bef9e7bf5af8a1478d89672ac0474b8 to your computer and use it in GitHub Desktop.
Save hishd/7bef9e7bf5af8a1478d89672ac0474b8 to your computer and use it in GitHub Desktop.
Enabling debugging mode on iOS Apps
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