Last active
May 1, 2022 17:31
-
-
Save andresr-dev/6edb124254735566fbed9f94cfe1169b to your computer and use it in GitHub Desktop.
This is an example of how to use @AppStorage
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 ContentView: View { | |
@AppStorage("tapCount") private var tapCount = 0 | |
var body: some View { | |
Button("Tap count: \(tapCount)") { | |
tapCount += 1 | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment