Post

Replies

Boosts

Views

Activity

Cannot select my created MKMapItem on the Map
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
0
0
384
Feb ’24
How to get the music MusicItemID of the specific song ?
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
2
0
614
Mar ’23
How to use MusicPlayer to play a song ?
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
1
0
621
Feb ’23
Can I use filter for MusicCatalogSearchRequest ?
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
0
0
489
Feb ’23
Make a list (or playlist) of specifics song by MusicKit or Apple Music API
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
1
0
566
Feb ’23