IOS TOPICS

IOS Introduction
Swift UI Label
Swift UI Button
Swift UI Text Field
Swift UI Slider
Swift UI Switch
Swift UI Stepper
Swift UI Date Picker
Swift UI Segmented Control
Views
Table View
Collection Views
SCROLL VIEW
iOS Content View
iOS View Controllers
iOS Bar interface
iOS Navigation interface
iOS Architect Pattern
iOS Libraries
iOS Web request and parsing
iOS user defaults
iOS Coredata and database

What is a Date Picker in SwiftUI


What is a Date Picker in SwiftUI?

DatePicker in SwiftUI allows users to view a scrolling wheel to pick a date and time. Like most UI controls, it can be customised greatly. In terms of function, its similar to the UIDatePicker from the UIKit.

Like most controls, it needs to have a binding variable to store its value.

Declaration:

DatePicker("< String label", selection: $< name of binding variable >,

displayedComponents: .date)

Or,

DatePicker("< String label", selection: $< name of binding variable >,

displayedComponents:[ .date, .hourandMinute])