Hi guys,
I am totally new to MusicKit or Apple Music API and new iOS developer, so this question is maybe not good for you. I want to build a list of songs ( or playlist) of specific songs I want, for example a list of 5 songs named A,B,C,... with specific artist but I am not sure how to do it. I took a look at WWDC about musickit but I can only study about musiccatalogrequest. May someone give me advice about this ? Thank you
Post
Replies
Boosts
Views
Activity
Hi,
I have this code that
let request: MusicCatalogSearchRequest = {
var request = MusicCatalogSearchRequest(term: "Money", types: [Song.self])
request.limit = 1
return request
}()
which request will responce() with a song by artist: Lisa
Therefore, can I add the filter with an artist I want ? Like
term: "Money" with artist = "Cardi B"
Thank you so much
Hi, I am currently learning how to use MusicKit, after fetching a song I want, I am not really sure how to use MusicPlayer in MusicKit to play that song,
For example
let request = MusicCatalogResourceRequest<Song>(matching: \.id,
equalTo: //sonmeMusicItemID)
let response = try await request.response()
guard let song = response.items.first else { return }
After having the song, how can I use MusicPlayer to play that song ? Thank you so much
Hi, . As my understading, I know that id: MusicItemID
The unique identifier for the song. Threfore, I want to try to retreive the specific song I want by using MusicItemID :
let request = MusicCatalogResourceRequest<Song>(matching: \.id,
equalTo: //MusicItemID)
let response = try await request.response()
guard let song = response.items.first else { return }
However, where can I find the MusicItemID for the song I want ? Thank you so much
Hi,
I try to retreive the number of playtime user played a song but the song.playCount always return nil ? is that the problem with user token or not ?
Thank you
Hi, I am learning about MapKit for SwiftUI, at first I created the MKMapItem
@State private var mapSelection: MKMapItem?
@State var starbucksReserve = MKMapItem(placemark: .init(coordinate: CLLocationCoordinate2D(latitude: 41.894178596474575, longitude: -87.62451598445733)))`
I put that in the Map
Map(position: $cameraPosition,selection: $mapSelection){
Marker("Starbucks Reserve", systemImage: "cup.and.saucer.fill" ,coordinate: starbucksReserve.placemark.coordinate)
}
Even though I have put the selection $mapSelection, my Marker is not selectable. I am not sure why. I tried to fix it by changing mapSelection to Int? and made a tag for Marker, but because I am learning how to use it so I want to make sure why marker cannot be selectable with the first approach?
Thank you