# HG changeset patch # User Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com> # Date 1614429926 0 # Node ID 3acc46851267a0bceb6a3d50c1c26501464eb52a # Parent 94f80732226a58bb449785c292903def0a1e7ae6 Add DateSelection diff -r 94f80732226a -r 3acc46851267 LazyBear/UI/DateSelection.swift --- a/LazyBear/UI/DateSelection.swift Sat Feb 27 12:45:17 2021 +0000 +++ b/LazyBear/UI/DateSelection.swift Sat Feb 27 12:45:26 2021 +0000 @@ -8,13 +8,21 @@ import SwiftUI struct DateSelection: View { + var period: [String] + @Binding var selectedperiod: Int + var body: some View { - Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + Picker(selection: $selectedperiod, label: Text("Please choose a period")) { + ForEach(0 ..< period.count) { + Text(self.period[$0]) + } + } + .pickerStyle(SegmentedPickerStyle()) } } struct DateSelection_Previews: PreviewProvider { static var previews: some View { - DateSelection() + DateSelection(period: ["1W", "1M", "3M", "6M", "1Y", "2Y", "5Y"], selectedperiod: .constant(0)) } }