Tuesday, April 2, 2024
HomeiOS Developmentios - Choose Month and Yr solely from Datepicker SwiftUi

ios – Choose Month and Yr solely from Datepicker SwiftUi


I need to cover the day when a datepicker is chosen. I solely need to present the month and yr. i’m utilizing Swift UI

how i’m calling it

.sheet(isPresented: $showDatePickerSheet) { DatePickerSheet(selectedDate: $cardExpiry) .presentationDetents([.medium]) }

Present DatePickerSheet

`struct DatePickerSheet: View {
@Binding var selectedDate: Date
@Surroundings(.presentationMode) var presentationMode

var physique: some View {
    NavigationView {
        DatePicker("Choose Date", choice: $selectedDate, displayedComponents: .date)
            .datePickerStyle(GraphicalDatePickerStyle())
            .padding()
            .navigationTitle("Choose Date")
            .toolbar {
                ToolbarItem(placement: .navigationBarTrailing) {
                    Button("Carried out") {
                        presentationMode.wrappedValue.dismiss()
                    }
                }
            }
    }
}

}`

How am i able to create this? Thanks upfront

I’ve tried modifying the displayed elements to one thing like yr and month nevertheless it doesn’t exist



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments