Mercurial > public > geoquiz
diff GeoQuiz/Models/Controllers/HapticsController.swift @ 26:425078c01194
refactor code
author | Dennis C. M. <dennis@denniscm.com> |
---|---|
date | Wed, 09 Nov 2022 10:30:01 +0100 |
parents | GeoQuiz/Logic/HapticsController.swift@f140bb277c96 |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GeoQuiz/Models/Controllers/HapticsController.swift Wed Nov 09 10:30:01 2022 +0100 @@ -0,0 +1,27 @@ +// +// HapticsController.swift +// GeoQuiz +// +// Created by Dennis Concepción Martín on 18/9/22. +// + +import Foundation +import SwiftUI + +class HapticsController { + private var user = UserController() + + func success() { + if user.data.haptics { + let generator = UINotificationFeedbackGenerator() + generator.notificationOccurred(.success) + } + } + + func error() { + if user.data.haptics { + let generator = UINotificationFeedbackGenerator() + generator.notificationOccurred(.error) + } + } +}