chunked(by:)

Returns a collection of subsequences of this collection, chunked by the given predicate.

Chunked.swift:459
func chunked(by belongInSameGroup: (Element, Element) throws -> Bool) rethrows -> [SubSequence]

Parameters

belongInSameGroup

A closure that takes two adjacent elements of the collection and returns whether or not they belong in the same group.