Post

Swift Group Array

1
let stopsGrouped: [[Stop]] = [_](Dictionary.init(grouping: stops, by: \.routeId).values)

[_] is equivalent to Array():

1
let stopsGrouped: [[Stop]] = Array(Dictionary.init(grouping: stops, by: \.routeId).values)
This post is licensed under CC BY 4.0 by the author.