Swift MusicKitプログラミング その9
Swift MusicKitプログラミング その9
Track
Albumのtracksは MusicItemCollection
Task() { print("\nExample 9 --------------------") let request = MusicCatalogSearchRequest(term: "氷室京介", types: [Album.self]) let response = try await request.response() if let album = response.albums.first { let withAlbum = try await album.with([.tracks]) withAlbum.tracks?.forEach({ print($0.title) switch($0) { case .song(let song): print("\(song.discNumber!)-\(song.trackNumber!)") default: break } }) } }
Example 9 -------------------- 魂を抱いてくれ 1-1 Dear Algernon 1-2 Stormy Night 1-3 Rainy Blue : : :