|
|
|
@ -117,7 +117,21 @@ struct TimePickerView: View { |
|
|
|
MultiComponentPicker(columns: columns, selections: [hoursBinding, minutesBinding, secondsBinding]) |
|
|
|
MultiComponentPicker(columns: columns, selections: [hoursBinding, minutesBinding, secondsBinding]) |
|
|
|
.frame(height: 200) |
|
|
|
.frame(height: 200) |
|
|
|
.previewLayout(.sizeThatFits) |
|
|
|
.previewLayout(.sizeThatFits) |
|
|
|
|
|
|
|
.onAppear { |
|
|
|
|
|
|
|
self._defineDuration() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fileprivate func _defineDuration() { |
|
|
|
|
|
|
|
let h = Int(duration / 3600.0) |
|
|
|
|
|
|
|
let m = Int(duration - Double(h * 3600)) / 60 |
|
|
|
|
|
|
|
let s = Int(duration - Double(h * 3600) - Double(m * 60)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.hours = h |
|
|
|
|
|
|
|
self.minutes = m |
|
|
|
|
|
|
|
self.seconds = s |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
struct MultiComponentPicker_Previews: PreviewProvider { |
|
|
|
struct MultiComponentPicker_Previews: PreviewProvider { |
|
|
|
|