comparison GeoQuiz/Logic/Haptics.swift @ 9:3540c7efc216

implement UserSettings
author Dennis C. M. <dennis@denniscm.com>
date Fri, 07 Oct 2022 18:50:38 +0200
parents 413e2d21333e
children
comparison
equal deleted inserted replaced
8:e09959b4e4a8 9:3540c7efc216
6 // 6 //
7 7
8 import Foundation 8 import Foundation
9 import SwiftUI 9 import SwiftUI
10 10
11 func hapticSuccess() { 11 class Haptics {
12 let generator = UINotificationFeedbackGenerator() 12 private var user = User()
13 generator.notificationOccurred(.success) 13
14 func success() {
15 if user.settings.haptics {
16 let generator = UINotificationFeedbackGenerator()
17 generator.notificationOccurred(.success)
18 }
19 }
20
21 func error() {
22 if user.settings.haptics {
23 let generator = UINotificationFeedbackGenerator()
24 generator.notificationOccurred(.error)
25 }
26 }
14 } 27 }
15
16 func hapticError() {
17 let generator = UINotificationFeedbackGenerator()
18 generator.notificationOccurred(.error)
19 }