NEW: Start my new Ultimate Portfolio App course with a free Hacking with Swift+ trial! >>

SOLVED: Day 28 - Project 4, part 3

Forums > 100 Days of SwiftUI

Hi again guys.

I solved the challenge but I searched the docs and find a different solution using stuff that Paul didn't teach yet.

Used the .onChange() modifier to call the method everytime some action change my @State's.

 DatePicker("Please enter a time",
                               selection: $wakeUp,
                               displayedComponents: .hourAndMinute)
                        .datePickerStyle(WheelDatePickerStyle())
                        .labelsHidden()
                        .onChange(of: wakeUp, perform: { value in
                            calculateBedTime()
                        })

But I really want to know how to solve that using the material that I learned until this lesson, as Paul says it's all we need to solve.

   

Well done. You will find that some of the challenges are not covered by the tutorial but that the point is to find outa way of doing it with search the web and stackoverflow etc.

1      

Wow Now I got it, thanks.

   

Hacking with Swift is sponsored by Stream

SPONSORED Check out Stream's cross-platform open source chat SDK on GitHub! Write once and deploy your app with fully featured chat UI on iOS and macOS.

Go to GitHub

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.