
Musickit
Integrate Apple Music playback, catalog search, and Now Playing metadata using MusicKit...
Install
npx skills add dpearson2699/swift-ios-skills --skill musickit -g -a claude-code -y- Repository
- dpearson2699/swift-ios-skills1.3k
- Category
- Mobile
- Updated
- 3mo ago
- License
- See repository
- Context cost
- Mediumabout 3,000 tokens
- Runs scripts
- No, instructions only
What it does
Integrate Apple Music playback, catalog search, and Now Playing metadata using MusicKit and MediaPlayer. Use when adding music search, Apple Music subscription flows, queue management, playback controls, remote command handling, or Now Playing info to iOS apps.
MusicKit
Search the Apple Music catalog, manage playback with ApplicationMusicPlayer,
check subscriptions, and publish Now Playing metadata via MPNowPlayingInfoCenter
and MPRemoteCommandCenter.
Contents
- Setup
- Workflow
- Authorization
- Catalog Search
- Subscription Checks
- Playback with ApplicationMusicPlayer
- Queue Management
- Now Playing Info
- Remote Command Center
- Common Mistakes
- Review Checklist
- References
Workflow
- Verify the MusicKit App Service, bundle identifier, purpose string, and background-audio mode before debugging code.
- Request authorization, then model every non-authorized state explicitly.
- Search or load catalog content and check
MusicSubscription.currentbefore queueing playback. - Choose
ApplicationMusicPlayerfor app-scoped playback; wire Now Playing and remote commands only when the app owns those surfaces. - Test authorized, denied, unsubscribed, offline, queue failure, interruption, and track-change states. Fix the smallest failing layer, restore the fixture, and rerun the same state matrix.
Setup
Project Configuration
- Enable the MusicKit App Service for the app's explicit bundle ID in the Apple Developer portal so MusicKit can generate developer tokens automatically.
- Add
NSAppleMusicUsageDescriptionto Info.plist explaining why the app accesses the user's media library. - For background playback, add the
audiobackground mode toUIBackgroundModes.
Imports
import MusicKit // Catalog, auth, playback
import MediaPlayer // MPRemoteCommandCenter, MPNowPlayingInfoCenter
