grouped(by:timeUnit:)
Creates a grouping of rows that the method selects by choosing unique units of time in a date column you select by column identifier.
Declaration
func grouped(by columnID: ColumnID<Date>, timeUnit: Calendar.Component) -> RowGrouping<Int>Parameters
- columnID:
A column identifier.
- timeUnit:
A component of a calendar date.
Return Value
A collection of groups.
Discussion
After the method aggregates the groups, it creates a column with the same name as the original column plus the timeUnit name.