I'm racking my head here trying to figure out the best way to do this, but I have two arrays. One array is a range of dates and another is a return of data.
Here's the function that returns an array of dates
func numberOfDaysBetween(startDate: Date, raceDate: Date) -> [Date] {
let numberOfDays = Calendar.current.dateComponents([.day], from: startDate, to: raceDate).day!
let week = (-numberOfDays...0).compactMap {
Calendar.current.date(byAdding: .day, value: $0, to: raceDate)
}
return week
}
I'm trying to get the dates to align to the weekdays listed here. https://api.npoint.io/6a55ea69409d7f3d90b4.
Would a ZStack
be appropriate here?