-
-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #230 from ReDetection/settings-swift-5.1
Multitouch settings & swift 5.1
- Loading branch information
Showing
6 changed files
with
73 additions
and
42 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import Foundation | ||
|
||
struct AppSettings { | ||
@UserDefault(key: "com.toxblh.mtmr.settings.showControlStrip", defaultValue: false) | ||
static var showControlStripState: Bool | ||
|
||
@UserDefault(key: "com.toxblh.mtmr.settings.hapticFeedback", defaultValue: true) | ||
static var hapticFeedbackState: Bool | ||
|
||
@UserDefault(key: "com.toxblh.mtmr.settings.multitouchGestures", defaultValue: true) | ||
static var multitouchGestures: Bool | ||
|
||
@UserDefault(key: "com.toxblh.mtmr.blackListedApps", defaultValue: []) | ||
static var blacklistedAppIds: [String] | ||
} | ||
|
||
@propertyWrapper | ||
struct UserDefault<T> { | ||
let key: String | ||
let defaultValue: T | ||
var wrappedValue: T { | ||
get { | ||
return UserDefaults.standard.object(forKey: key) as? T ?? defaultValue | ||
} | ||
set { | ||
UserDefaults.standard.set(newValue, forKey: key) | ||
UserDefaults.standard.synchronize() | ||
} | ||
} | ||
} |
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
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
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