I was trying to use AVPlayerView
in Swift, but the compiler complaints that it cannot find a member named player
in AVPlayerView
.
But AVPlayerView
clearly does have a property called player
.
And other properties or methods are fine. It seems that only player
is not recognized.
You explicitly have to import the AVFoundation framework (which defines
the AVPlayer
class):
import AVKit
import AVFoundation
let playerView = AVPlayerView()
let player = playerView.player
That might be considered as a bug in the (Swift view of the) AVKit framework.