Check out example codes for "how to read music library from iphone programmatically in swift". It will help you in understanding the concepts better.

Code Example 1

// All
let mediaItems = MPMediaQuery.songsQuery().items
// Or you can filter on various property
// Like the Genre for example here
var query = MPMediaQuery.songsQuery()
let predicateByGenre = MPMediaPropertyPredicate(value: "Rock", forProperty: MPMediaItemPropertyGenre)
query.filterPredicates = NSSet(object: predicateByGenre)

Learn ReactJs, React Native from akashmittal.com