Created
August 20, 2023 17:07
-
-
Save mattyoung/f8ad5a7b81bb82d670e612ceb02f3b1d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import SwiftUI | |
struct SensoryFeedback: View { | |
@State private var count = 0 | |
var body: some View { | |
VStack { | |
Text(verbatim: "\(count)") | |
.font(.largeTitle) | |
.contentTransition(.numericText(value: Double(count))) | |
Button("+++++++") { | |
count += 1 | |
} | |
.sensoryFeedback(.increase, trigger: count) | |
} | |
.animation(.easeIn(duration: 0.1), value: count) | |
} | |
} | |
#Preview { | |
SensoryFeedback() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment