DEV Community

Nathan Mattes
Nathan Mattes

Posted on • Originally published at zeitschlag.net on

1

100 Days of SwiftUI — Day 28

I missed yesterday, as life got in my way. But I didn't want to miss today, too, so I sat down before going to bed and just did Day 28: It was review time, again. I passed a small test and solved three challenges.

The last one was actually pretty tricky for me: I had to get rid of the button to start the bedtime-calcultion and show the calculated bedtime all the time instead.

My approach was to use a computed property for the bedtime, that gets calculated everytime the UI changes. This feels a bit unusual, but it works. With UIKit I would have used pickerView(_:didSelectRow:inComponent:), for example, but I didn't find such init-parameters for all the necessary UI-elements. While I can provide a stepper with closures to run onIncrement and onDecrement, for example, I didn't find anything similar for neither PickerView, nor DatePickerView. And so in the end, I used a computed property for bedTime.

How did you solve the three challenges for Day 28?

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

Top comments (0)

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay