Grouping Dictionary in Swift | init(grouping:by:)
Creates a new dictionary whose keys are the groupings returned by the given closure and whose values are arrays of the elements that returned each key.
Reference Link :
https://developer.apple.com/documenta...
Thank you