TextField
TextField("Your answer is ...", text: $answer) .keyboardType(.numberPad) .textFieldStyle(RoundedBorderTextFieldStyle())
Stepper
Stepper(value: $sleepAmount, in: 4...12, step: 0.25) { Text("\(sleepAmount, specifier: "%g") hours") }
Slider
Slider(value: $width, in: 0...100)
Picker
Picker("", selection: $unitId) { ForEach(0 ..< units.count) { Text("\(self.units[$0])") } } .pickerStyle(SegmentedPickerStyle())
DatePicker
DatePicker("Please enter a date", selection: $wakeUp, displayedComponents: .hourAndMinute) .labelsHidden() .datePickerStyle(WheelDatePickerStyle())
Alert
.alert(isPresented: $showAlert) { Alert(title: Text("title"), message: Text("message"), dismissButton: .default(Text("OK")) { self.someFunction() }) }