The MusicKit framework allows iOS apps to play a user's Apple Music & local music.
Introduced with iOS 11, MusicKit on iOS lets users play Apple Music and their local music library natively from third party apps and games. When a user provides permission to their Apple Music account, an iOS app can create playlists, add songs to their library, and play any of the millions of songs in the Apple Music catalog. If the app detects that the user is not yet an Apple Music member, you can offer a trial from within your app.