Skip to content

Instantly share code, notes, and snippets.

@DonMag
Last active October 19, 2016 19:04
Show Gist options
  • Select an option

  • Save DonMag/402e889d54b5394fef80b20f4131655e to your computer and use it in GitHub Desktop.

Select an option

Save DonMag/402e889d54b5394fef80b20f4131655e to your computer and use it in GitHub Desktop.
if thisDay != currentDay {
// if thisDay is NOT equal to currentDay, then it is the first event of the NEXT day
// append the array of the current day's events to the "master" array
mArray.append(oneDaysEvents)
// set currentDay to the day of this event
currentDay = thisDay
// reset oneDaysEvents array
oneDaysEvents = [EKEvent]()
// append this event to the oneDaysEvents array
oneDaysEvents.append(event)
// if this is Also the Last event, append the new oneDaysEvent array to the "master" array
if event == allEvents.last {
mArray.append(oneDaysEvents)
}
} else if event == allEvents.last {
// this is the Last event, so add it to the oneDaysEvents
oneDaysEvents.append(event)
// then add oneDaysEvents array to the "master" array
mArray.append(oneDaysEvents)
} else {
// this is another event on the current day (but is not the LAST event in the list), so add it to oneDaysEvents array
oneDaysEvents.append(event)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment