I am trying to create a UIImageView with the album artwork of the song currently playing on a music player. All of the resources I have found are either in objective-c (which I don't know) or do not work (maybe I am not implementing it correctly).
I am currently trying to do this with this code:
class ViewController: UIViewController {
@IBOutlet weak var backgroundAlbum: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
backgroundAlbum.image = MPMediaItemArtwork()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
but I am getting an error in the line
backgroundAlbum.image = MPMediaItemArtwork()
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…