Grouping Array Elements With Dictionary in Swift

Swift 5 introduced a new initializer for Dictionary, which allows us to create a dictionary of grouped elements from an input array. Here, Lee Kah Seng demonstrates how we can use this initializer to group array elements based on a custom property of the array element type.