Mercurial > public > geoquiz
diff 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 |
line wrap: on
line diff
--- a/GeoQuiz/Logic/Haptics.swift Thu Oct 06 11:14:34 2022 +0200 +++ b/GeoQuiz/Logic/Haptics.swift Fri Oct 07 18:50:38 2022 +0200 @@ -8,12 +8,20 @@ import Foundation import SwiftUI -func hapticSuccess() { - let generator = UINotificationFeedbackGenerator() - generator.notificationOccurred(.success) -} +class Haptics { + private var user = User() + + func success() { + if user.settings.haptics { + let generator = UINotificationFeedbackGenerator() + generator.notificationOccurred(.success) + } + } -func hapticError() { - let generator = UINotificationFeedbackGenerator() - generator.notificationOccurred(.error) + func error() { + if user.settings.haptics { + let generator = UINotificationFeedbackGenerator() + generator.notificationOccurred(.error) + } + } }