top of page

How To Use Date Picker's in SwiftUI 2.0

Updated: Feb 19, 2021

Date Picker's are very useful in any app you are developing today!

Using Date Pickers just got so much easier to integrate in your app with SwiftUI 2.0!

Let's Explore How to use it! You Can Also Skip the Blog and watch the Youtube Video Directly!


Let's Start by creating a variable which will reference Date, so we can later use it!

@State var date = Date()

Inside your body add a VStack containing a Text followed b a DatePicker. Just like this.


VStack{
    Text("\(date)") //To display the Date by DatePicker
    DatePicker("Enter a Date", selection: $date)
}

With just those simple lines of code we have now integrated a simple Date Picker in our app. Run your app in the simulator and you will see it working perfectly. However, if you run the app you will realise that the date presented provides much more information than needed! To see how we can customise this, please continue by watching the video!

Thank You! Good Luck!

 

 

You Have Been working Hard! Treat YourSelf!


123 views1 comment

1 Comment


Delighted Sunday just one and all.The Arizona Cardinals sit at 1-0 within their 2021 preseason, and their initial video game gave us a wonderful look of what we can count on for going into the year.We consist of all the information and notes coming out of the video game, make it possible for's choose toward it.Rondale Moore, Zaven Collins Display Out Inside Preseason Opener For CardinalsYoung avid gamers generate assume in just 19-16 earn about CowboysZaven Commences Tender, At the outset of a clean year, Arizona Cardinals quarterback Kyler Murray isn't intrigued within just nonetheless once again recounting the signature engage in of his c…Sharp Soccer Study ranks Cardinals substantial at QB, reduced at RBSharp Soccer Investigate rated positional…


Like
bottom of page