How to create a date picker and read values from it

preview_player
Показать описание
SwiftUI’s DatePicker view is analogous to UIDatePicker, and comes with a variety options for controlling how it looks and works. Like all controls that store values, it does need to be bound to some sort of state in your app.
Рекомендации по теме
Комментарии
Автор

Do you have a pointer to a similar sample but using iOS UIKit?

MarkHudson
Автор

There is a modifier datePickerStyle but I can't figure out what styles can be used... do you know about that? I have date fields but I don't want the date wheels visible at all times, only when a date field is being tapped to be edited.

poluxsaurus
Автор

Great tutorials buddy, I wdve never thought I could learn so much. A quick question, how do we convert the hoursandminute displaycomponent to a 24hr clock? I need a timepicker without the AM/PM selection. Thanks.


EDIT:
Found the solution : just add .environment(\.locale, Locale.init(identifier: “en_GB”)) to your DatePicker

netfreak
Автор

Hey, is there a simple way to create a country picker, rather than having to add all the countries to an array?

abdullahajmal
join shbcf.ru