Questions tagged [swiftui-datepicker]
17 questions
6
votes
2 answers
SwiftUI DatePicker in Form Dismisses When Keyboard Appears
I have a SwiftUI Form with a Section that contains a DatePicker. The DatePicker is set to have a datePickerStyle of CompactDatePickerStyle(), by default, since it's in a Form.
When tapping on the DatePicker, the overlay is presented:
The…

Nick Kohrn
- 5,779
- 3
- 29
- 49
2
votes
1 answer
SwiftUI: Detected a case where constraints ambiguously suggest a height of zero for a table view cell's content view
How can I fix the reason why the warning appears?
struct ContentView: View {
@State private var selectedDate: Date = Date()
var body: some View {
Form {
DatePicker("Date", selection: $selectedDate, displayedComponents:…

Isaak
- 1,107
- 2
- 11
- 29
1
vote
1 answer
How could I implement TabView page switching as a function of a selected date from DatePicker?
I've implemented the following code for my TabView and a DatePicker. I can currently slide between the three pages. And I can use the DatePicker to select between the 3 permitted days
import SwiftUI
struct DailyOverviewTab: View {
@State private…

99natmar99
- 33
- 6
1
vote
2 answers
Update SwiftUI Date Picker to match a model's computed property: Cannot assign to property
I have a form which lets the user create a project. In this form, I want to automatically change the project's deadline DatePicker based on the user's input such as start date, daily count, and target count. If the DatePicker's date is changed, then…

Michael Hsieh
- 67
- 8
1
vote
1 answer
SwiftUI: A list with a DatePicker and Text mangles the display
On iOS 15, if you display a List of VStacks with a Text and DatePicker as below
@main
struct WeirdListDatePickerProblem: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
struct ContentView: View {
…

mmm111mmm
- 3,607
- 4
- 27
- 44
1
vote
1 answer
SwiftUI TimePicker Bindings to the view of the parent view
Hello, I would like to take some advice on my requirement. I have a parent view which has a child view and that has one more child view. Basically, I would like to pass the binded value to the parent view. Parent View (SubChildView-Value) -> Child…

DILIP KOSURI
- 455
- 5
- 10
1
vote
0 answers
Why UIDatePicker is not showing the time and days in .inline style in iOS 15
Hi I have a UIDatePicker with inline style and dateAndTime mode as InputView to a UITextField, and when datePicker appears its not showing the days and the time. Please refer the image1(when it appears) and image2(when tap on time).
This is my…

Hilaj S L
- 1,936
- 2
- 19
- 31
1
vote
0 answers
SwiftUI Datepicker changes format after selecting date
I've implemented a DatePicker with SwiftUI.
It works for the most part as is should, but when selecting a specific date, e.g 26. Nov 2019, it changes the format of the displayed date text.
Exampels:
Expected: 26. Nov 2019
Got: 26.11.2019
Expected…

Daniel
- 50
- 1
- 7
1
vote
1 answer
minimumDate equivalent in swiftUI?
I have a DatePicker on my app and the user can't select a past date, because I'm creating a notification out of it
How can I implement a minimumDate equivalent in SwiftUI?
I tried creating an alert on my save button using “if date < Date(), else…

fabiofiorita
- 21
- 5
0
votes
0 answers
SwiftUI DatePicker generating 200 line AutoLayout errors?
I'm getting 200 lines of AutoLayout errors in the console from SwiftUI's DatePicker. Looks like something to do with the label. In testing, this is happening in a blank project with nothing else in the view.
The logs are annoying but the more…

JBZic
- 53
- 6
0
votes
0 answers
DatePicker with additional buttons to modify date - incorrect display format
I'm trying to create a View to allow me to tap a back arrow to go back a day, tap a forward arrow to go forward a day, and tap a date picker to select a specific date more quickly. The UI looks like this:
This works, but has a strange side effect.…

Jr795
- 691
- 1
- 8
- 15
0
votes
1 answer
SwiftUI DatePicker not acting as expcted
I need to show two dates as showing in the screenshot fromDate & toDate. I'm getting some UI issue after selecting date from first component showing date on screen Jul 1, 2021 but after selecting date from second date picker its atomically changing…

Jessy
- 157
- 1
- 10
0
votes
1 answer
SwiftUI - Use DatePicker GraphicalDatePickerStyle as a read-only calendar
I want to display a calendar with a set of dates marked (It reflects all the reservations a user has scheduled in a month on my application).
I'm trying to do that without creating a calendar component or importing a library. So, here I'm using the…

chr0x
- 1,151
- 3
- 15
- 25
0
votes
1 answer
My UIDatePicker Is Not Coming Propper format
here is my code.
extension ProfileViewController {
private func openDatePicker() {
let datePicker = UIDatePicker()
datePicker.datePickerMode = .date
ageTextFieldOutlet.inputView = datePicker
let toolBar =…

Chandan
- 283
- 2
- 6
0
votes
1 answer
Swiftui DatePicker events
I have a DatePicker such as:
DatePicker("DATE & TIME", selection: Binding(get: {
self.dateTime
}, set: { newValue in
self.dateTime = newValue
if newValue > Date() {
sendDateTimeToServer()
}
}), displayedComponents: [.date,…

Brendon
- 673
- 1
- 8
- 19