Skip to content

Instantly share code, notes, and snippets.

@harlanhaskins
Created December 20, 2024 19:27
Show Gist options
  • Save harlanhaskins/832ba1253b1df0a61158be5988b31278 to your computer and use it in GitHub Desktop.
Save harlanhaskins/832ba1253b1df0a61158be5988b31278 to your computer and use it in GitHub Desktop.
UIKit user defaults for gesture logging
@MainActor
enum UIKitDefaults {
static let defaults = UserDefaults(suiteName: "com.apple.UIKit")!
// Enables UIKit gesture logging, which will log the set of gesture recognizers responding to a touch and their states.
static var gestureLoggingEnabled: Bool {
get { defaults.bool(forKey: "LogGesture") }
set { defaults.set(newValue, forKey: "LogGesture") }
}
// Enables gesture environment logging, which will log the set of gestures and their failure relationships in the gesture graph.
static var gestureEnvironmentLoggingEnabled: Bool {
get { defaults.bool(forKey: "LogGestureEnvironment") }
set { defaults.set(newValue, forKey: "LogGestureEnvironment") }
}
// Enables touch logging, which will log all touches sent to the app and the view that receives them.
static var touchLoggingEnabled: Bool {
get { defaults.bool(forKey: "LogTouch") }
set { defaults.set(newValue, forKey: "LogTouch") }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment