Skip to content

Instantly share code, notes, and snippets.

@fdstevex
Created July 27, 2023 23:27
Show Gist options
  • Save fdstevex/9476c6dd83810a9ae8a22a16de8768ce to your computer and use it in GitHub Desktop.
Save fdstevex/9476c6dd83810a9ae8a22a16de8768ce to your computer and use it in GitHub Desktop.
struct Settings {
static var documentSelected = false
}
struct FolderPage: View {
@State var documentsLabel: String = Settings.documentSelected ? "Selected" : "Not selected"
var body: some View {
VStack {
VStack {
if !Settings.documentSelected {
Text("Not selected yet")
} else {
Text("Selected folder:")
Text(documentsLabel)
.font(.title)
}
Button(action: {
documentsLabel = "New Value"
Settings.documentSelected = true
}, label: {
Text("Select Folder")
})
}
}.padding(30)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment