Mercurial > public > lazybear
view LazyBear/UI/DateSelection.swift @ 214:3acc46851267
Add DateSelection
author | Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com> |
---|---|
date | Sat, 27 Feb 2021 12:45:26 +0000 |
parents | 53b47dcc1b6c |
children |
line wrap: on
line source
// // DateSelection.swift // LazyBear // // Created by Dennis Concepción Martín on 27/2/21. // import SwiftUI struct DateSelection: View { var period: [String] @Binding var selectedperiod: Int var body: some View { 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(period: ["1W", "1M", "3M", "6M", "1Y", "2Y", "5Y"], selectedperiod: .constant(0)) } }