Skip to content

Instantly share code, notes, and snippets.

@notoroid
Created February 24, 2021 05:24
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save notoroid/b26ed6506a6347ea0a8ad436d6b7b6fd to your computer and use it in GitHub Desktop.
struct ContentView: View {
@AppStorage(wrappedValue: false, "enabled_preference") var enabled_preference
var body: some View {
NavigationView {
Text("The toolbar is displayed in conjunction with the switch On/Off in the Settings application - Third Party Application Settings - Sample Application Settings.\n\nNote: The AppStorage value will revert to its initial value after each app transfer after the build, so build carefully.")
.padding()
.toolbar {
ToolbarItemGroup(placement: .bottomBar) {
if enabled_preference {
Spacer()
Button("Log") {
}
}
}
}
.navigationTitle("AppStorage example")
}
.navigationBarTitleDisplayMode(.inline)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment