https://github.com/noppefoxwolf/nfappstorage
https://github.com/noppefoxwolf/nfappstorage
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/noppefoxwolf/nfappstorage
- Owner: noppefoxwolf
- License: mit
- Created: 2020-06-28T04:50:14.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-06-28T10:41:27.000Z (almost 6 years ago)
- Last Synced: 2024-05-02T05:46:07.615Z (about 2 years ago)
- Language: Swift
- Size: 58.6 KB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NFAppStorage
Backport of @AppStorage to earlier iOS 13.
[AppStorage](https://developer.apple.com/documentation/swiftui/appstorage) is UserDefaults binder available in iOS14.
# Usage
```swift
struct ContentView: View {
@AppStorage("username") var username: String = "Anonymous"
var body: some View {
VStack {
Text("Welcome, \(username)!")
Button("Log in") {
self.username = "@twostraws"
}
}
}
}
```
# Requirements
- Swift 5.0+
- iOS 13.0+
# Installation
## Xcode SwiftPM
Add the following to your Xcode:

# Author
[noppefoxwolf](https://twitter.com/noppefoxwolf)
# License
The project is available under [MIT Licence](https://github.com/noppefoxwolf/NFAppStorage/blob/master/LICENSE)