Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

How to access mediaItemCollection

I am using mediaPicker to pick a song from the users ipod library however I do not know how to continue, I would like to access those songs and store them as variables so I can access them, however I don't quite understand protocols and delegates, this is my code so far

protocol NSObjectProtocol {
func mediaPicker(mediaPicker: MPMediaPickerController!, didPickMediaItems mediaItemCollection: MPMediaItemCollection!)

}

edit: as you can see I am very new to swift this is all I have to attempt what I am describing var NSURL = mediaPicker(mediaPicker:MPMediaPickerController, didPickMediaItems: MPMediaItemPropertyAssetURL)

there is also no class reference for NSURL in swift, it is only in objective C