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?
Top comments (0)