Skip to content

Commit

Permalink
- renamed unregisterAll() to resetAll()
Browse files Browse the repository at this point in the history
  • Loading branch information
stormychel committed Oct 6, 2024
1 parent 761d28b commit 0af13cf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Binary file added .DS_Store
Binary file not shown.
Binary file added Sources/.DS_Store
Binary file not shown.
9 changes: 5 additions & 4 deletions Sources/KeyboardShortcuts/KeyboardShortcuts.swift
Original file line number Diff line number Diff line change
Expand Up @@ -264,21 +264,22 @@ public enum KeyboardShortcuts {
}

/**
Unregister all keyboard shortcuts and remove their stored values from `UserDefaults`.
Reset all keyboard shortcuts and remove their stored values from `UserDefaults`.

This method unregisters all keyboard shortcuts registered via `KeyboardShortcuts` and removes any associated data stored in `UserDefaults`.
This method resets all keyboard shortcuts registered via `KeyboardShortcuts` and removes any associated data stored in `UserDefaults`.

Use this method to completely reset the state of all keyboard shortcuts in your app, including removing any saved user-defined shortcuts and default shortcuts.

- Note: This action cannot be undone. All shortcuts will be removed, including any default shortcuts defined in `Name`. If you want to reset shortcuts back to their default values, consider using `.reset(_:)` instead.

- Important: This method affects all shortcuts registered with `KeyboardShortcuts` and should be used with caution.
*/
public static func unregisterAll() {
public static func resetAll() {
// remove shortcuts
CarbonKeyboardShortcuts.unregisterAll()
registeredShortcuts.removeAll()

Check warning on line 281 in Sources/KeyboardShortcuts/KeyboardShortcuts.swift

View workflow job for this annotation

GitHub Actions / lint

Trailing Whitespace Violation: Lines should not have trailing whitespace (trailing_whitespace)

Check warning on line 281 in Sources/KeyboardShortcuts/KeyboardShortcuts.swift

View workflow job for this annotation

GitHub Actions / lint

Trailing Whitespace Violation: Lines should not have trailing whitespace (trailing_whitespace)
// remove user defaults too
// remove userdefaults
let userDefaults = UserDefaults.standard

for key in userDefaults.dictionaryRepresentation().keys where key.hasPrefix("KeyboardShortcuts_") {
Expand Down

0 comments on commit 0af13cf

Please sign in to comment.