Created
June 14, 2017 14:48
-
-
Save mdmsua/e34efeacd4dd1d5eb4be2514804145c4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if let library = try? ITLibrary(apiVersion: "1") { | |
print(library.applicationVersion) | |
for artist in library.allMediaItems | |
.filter({ $0.mediaKind == ITLibMediaItemMediaKind.kindSong }) | |
.group(by: { $0.artist?.name }){ | |
print(artist.key) | |
for album in artist.value.group(by: { $0.album.title }) { | |
print(" \(album.key) (\(album.value.first!.year))") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment