I’m trying to create a video player in SwiftUi with a AVPlayerViewController. I found that I have to use a struct that conforms to the UIViewControllerRepresentable protocol
struct AVPlayerControllerRepresented : UIViewControllerRepresentable {
typealias UIViewControllerType = AVPlayerViewController
var player : AVPlayer
func makeUIViewController(context: Context) -> AVPlayerViewController {
let controller = AVPlayerViewController()
controller.player = player
return controller
}
func updateUIViewController(_ uiViewController: AVPlayerViewController, context: Context) {
}
}
but Xcode keeps saying it doesn’t conform
I tried pressing the fix button next to the error but it just adds the same functions that are already there
func makeUIViewController(context: Context) -> AVPlayerViewController {
<#code#>
}
func updateUIViewController(_ uiViewController: AVPlayerViewController, context: Context) {
<#code#>
}




