NFAppStorage

MIT License

Stars
7
Committers
1

NFAppStorage

Backport of @AppStorage to earlier iOS 13. AppStorage is UserDefaults binder available in iOS14.

Usage

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

License

The project is available under MIT Licence