87 lines
2.8 KiB
Swift
87 lines
2.8 KiB
Swift
//
|
|
// OnboardingDay.swift
|
|
// Feels (iOS)
|
|
//
|
|
// Created by Trey Tartt on 1/20/22.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
enum DayOptions: String, CaseIterable, RawRepresentable, Codable {
|
|
case Today = "Same Day"
|
|
case Previous = "Previous Day"
|
|
}
|
|
|
|
struct OnboardingDay: View {
|
|
@ObservedObject var onboardingData: OnboardingData
|
|
|
|
var previewText: String {
|
|
switch onboardingData.inputDay {
|
|
case .Today:
|
|
return "Example: If you pick on a Tuesday, the value will be recorded for Tuesday"
|
|
case .Previous:
|
|
return "Example: If you pick on a Tuesday, the value will be recorded for Monday, the day before"
|
|
}
|
|
}
|
|
|
|
var body: some View {
|
|
ZStack {
|
|
|
|
Image("average", bundle: .main)
|
|
.foregroundColor(Color(UIColor.darkText))
|
|
.opacity(0.04)
|
|
.scaleEffect(1.2)
|
|
.padding(.bottom, 55)
|
|
|
|
ScrollView {
|
|
VStack{
|
|
Text("Will this rating be for current day or previous day")
|
|
.font(.title)
|
|
.foregroundColor(Color(UIColor.white))
|
|
.padding([.trailing, .leading], 55)
|
|
.padding([.top], 25)
|
|
|
|
Picker(selection: $onboardingData.inputDay,
|
|
label: Text("")) {
|
|
ForEach(DayOptions.allCases, id: \.self) { day in
|
|
Text(day.rawValue)
|
|
}
|
|
}
|
|
.padding()
|
|
.colorScheme(.dark)
|
|
.padding([.trailing, .leading], 55)
|
|
.pickerStyle(SegmentedPickerStyle())
|
|
|
|
Text("When you vote your vote will be for the \(onboardingData.inputDay.rawValue)")
|
|
.font(.body)
|
|
.foregroundColor(Color(UIColor.white))
|
|
.padding([.trailing, .leading], 75)
|
|
.padding([.top], 15)
|
|
|
|
Text(previewText)
|
|
.font(.body)
|
|
.foregroundColor(Color(UIColor.white))
|
|
.padding([.trailing, .leading], 75)
|
|
.padding([.top], 15)
|
|
|
|
Spacer()
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
.background(.blue)
|
|
}
|
|
}
|
|
|
|
struct OnboardingDay_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
Group{
|
|
OnboardingDay(onboardingData: OnboardingData())
|
|
|
|
OnboardingDay(onboardingData: OnboardingData())
|
|
.preferredColorScheme(.dark)
|
|
}
|
|
}
|
|
}
|