Working in HealthKit, I have an array of HealthKit Workouts that I need to organize into month and year (so that I can display workouts from Jan 2018, Feb 2018 etc.).  What makes it difficult in my mind is I first need to check if there is a workout for a given month and year, if not I need to create the array for it, if there is I need to append to the existing array.  I also am unsure of the best data model, I was thinking of using a [[Month:Year]] but that doesn't seem very Swifty? 
guard let workoutsUnwrapped = workouts else { return }
for workout in workoutsUnwrapped {
    let calendar = Calendar.current
    let year = calendar.component(.year, from: workout.startDate)
    let month = calendar.component(.month, from: workout.startDate)
}