Post

Replies

Boosts

Views

Activity

Reply to What is the best way to align an array of dates with another array.
Correct. Ideally 09/08, 09/09 would match with the appropriate day. Here's a pretty bare bones of the code. Sorry I can't get it formatted right @StateObject var planData = DownloadHansonData() @AppStorage("startDate") var userStartDate: Date = Date() @AppStorage("raceDate") var userRaceDate: Date = Date() @State var startDate = Date() @State var endDate = Date() @State var dateRange: [Date] = [] var body: some View { VStack { // ForEach(dateRange, id: \.self) { day in ScrollView { ForEach(planData.trainingdata) { index in HStack { Text("\(index.day0.day) - \(index.day0.exercise)") Spacer() } HStack { Text("\(index.day1.day) - \(index.day1.exercise)") Spacer() } HStack { Text("\(index.day2.day) - \(index.day2.exercise)") Spacer() } HStack { Text("\(index.day3.day) - \(index.day3.exercise)") Spacer() } HStack { Text("\(index.day4.day) - \(index.day4.exercise)") Spacer() } HStack { Text("\(index.day5.day) - \(index.day5.exercise)") Spacer() } HStack { Text("\(index.day6.day) - \(index.day6.exercise)") Spacer() } // } } .padding() } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Sep ’21