changeset 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 94f80732226a
children 59501991d5b3
files LazyBear/UI/DateSelection.swift
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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))
     }
 }