-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1b16aab
commit bef84fc
Showing
10 changed files
with
142 additions
and
109 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
Binary file modified
BIN
+1.19 KB
(100%)
Vazhegan.xcworkspace/xcuserdata/Golparvar.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
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
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,45 @@ | ||
// | ||
|
||
import Foundation | ||
import UIKit | ||
|
||
enum Haptic { | ||
|
||
enum HapticFeedbackStyle: Int { | ||
case light, medium, heavy | ||
|
||
var value: UIImpactFeedbackGenerator.FeedbackStyle { | ||
return UIImpactFeedbackGenerator.FeedbackStyle(rawValue: rawValue)! | ||
} | ||
} | ||
|
||
enum HapticFeedbackType: Int { | ||
case success, warning, error | ||
|
||
var value: UINotificationFeedbackGenerator.FeedbackType { | ||
return UINotificationFeedbackGenerator.FeedbackType(rawValue: rawValue)! | ||
} | ||
} | ||
|
||
|
||
case impact(HapticFeedbackStyle) | ||
case notification(HapticFeedbackType) | ||
case selection | ||
|
||
func generate() { | ||
switch self { | ||
case .impact(let style): | ||
let generator = UIImpactFeedbackGenerator(style: style.value) | ||
generator.prepare() | ||
generator.impactOccurred() | ||
case .notification(let type): | ||
let generator = UINotificationFeedbackGenerator() | ||
generator.prepare() | ||
generator.notificationOccurred(type.value) | ||
case .selection: | ||
let generator = UISelectionFeedbackGenerator() | ||
generator.prepare() | ||
generator.selectionChanged() | ||
} | ||
} | ||
} |
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
Oops, something went wrong.