SwiftUI DatePicker with inline style

Hi,

I want to set the style of a DatePicker to inline but I can't figure out how to do it.

My DatePicker is defined like this:
Code Block
DatePicker("Time",
selection: $time,
displayedComponents: [.hourAndMinute])
.pickerStyle(InlinePickerStyle())

Unfortunately the picker is not really displayed inline because when the user tap on it the picker is presented modally over a blurred background.

I tried to change the available picker styles but the result is always the same.

I want to achieve what Apple did in the Remainders App. Here when you activate the "Date" or "Time" switch a date picker is displayed inline.

Can anyone help me?

Thank you
Answered by DaleOne in 641343022
What I needed was GraphicalDatePickerStyle not InlinePickerStyle.

This work:
Code Block
DatePicker(
"Time",
selection: $time,
displayedComponents: [.hourAndMinute])
.datePickerStyle(GraphicalDatePickerStyle())


Accepted Answer
What I needed was GraphicalDatePickerStyle not InlinePickerStyle.

This work:
Code Block
DatePicker(
"Time",
selection: $time,
displayedComponents: [.hourAndMinute])
.datePickerStyle(GraphicalDatePickerStyle())


SwiftUI DatePicker with inline style
 
 
Q