Skip to content

Instantly share code, notes, and snippets.

@laevandus
Last active February 5, 2022 01:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laevandus/be02c83927bbc6eca36f824c5550b407 to your computer and use it in GitHub Desktop.
Save laevandus/be02c83927bbc6eca36f824c5550b407 to your computer and use it in GitHub Desktop.
struct ContentView: View {
@StateObject var viewModel = ViewModel()
var body: some View {
NavigationView {
Form {
Section {
// …
DateDurationPicker(
selection: $viewModel.selection,
values: Array(1..<100),
units: DateDuration.Unit.allCases
)
// …
}
}
.navigationTitle("Reminders")
}
}
}
extension ContentView {
final class ViewModel: ObservableObject {
@Published var selection = DateDuration(value: 1, unit: .days)
// …
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment