The previous answer from @Jack no longer works as is and needs some modifications.
The Swift 3 compiler complains about 2 things.
- A string is not directly converted to AnyObject, and therefore two dictionary entries must be written from String to AnyObject.
defaultCenter() been renamed to default() .
therefore, viable code would look like this:
MPNowPlayingInfoCenter.default().nowPlayingInfo = [MPMediaItemPropertyArtist : "Artist!" as AnyObject, MPMediaItemPropertyTitle : "Title!" as AnyObject]
source share