iTunesLibrary - Swift

I started dabbling with the iTunes library for Swift and came across the example below on line for reading data from the library on MacOS. However, I keep getting hit with a "Type of expression is ambiguous without more context" error on line 6. I can't think of what is causing the error, any ideas ?

Code Block func ListTunes(){
    if let library = try? ITLibrary(apiVersion: "1") {
                print(library.applicationVersion)
                for artist in library.allMediaItems
                    .filter({ $0.mediaKind == ITLibMediaItemMediaKind.kindSong })
                        .group(by: { $0.artist?.title }){
                            print(artist.key)
                    for album in artist.value.group(by: { $0.album.title }) {
                        print(" \(album.key) (\(album.value.first!.year))")
                    }
                }
            }
}


I cannot reproduce the same error with your code, but get Value of type '[ITLibMediaItem]' has no member 'group'.

Are you using any sort of extensions providing group(by:)?
Please show more context.
iTunesLibrary - Swift
 
 
Q