2021-09-25 08:18:22 +00:00
|
|
|
import Defaults
|
2021-07-18 22:32:46 +00:00
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
struct Player: UIViewControllerRepresentable {
|
2021-10-05 20:20:09 +00:00
|
|
|
@EnvironmentObject<PlayerModel> private var player
|
2021-08-23 21:31:51 +00:00
|
|
|
|
2021-10-05 20:20:09 +00:00
|
|
|
var controller: PlayerViewController?
|
|
|
|
|
|
|
|
init(controller: PlayerViewController? = nil) {
|
|
|
|
self.controller = controller
|
|
|
|
}
|
2021-07-18 22:32:46 +00:00
|
|
|
|
|
|
|
func makeUIViewController(context _: Context) -> PlayerViewController {
|
2021-10-05 20:20:09 +00:00
|
|
|
if self.controller != nil {
|
|
|
|
return self.controller!
|
|
|
|
}
|
|
|
|
|
2021-07-18 22:32:46 +00:00
|
|
|
let controller = PlayerViewController()
|
2021-08-22 19:13:33 +00:00
|
|
|
|
2021-10-05 20:20:09 +00:00
|
|
|
controller.playerModel = player
|
2021-10-16 22:48:58 +00:00
|
|
|
player.controller = controller
|
2021-07-18 22:32:46 +00:00
|
|
|
|
|
|
|
return controller
|
|
|
|
}
|
|
|
|
|
2021-10-18 21:53:02 +00:00
|
|
|
func updateUIViewController(_: PlayerViewController, context _: Context) {}
|
2021-07-18 22:32:46 +00:00
|
|
|
}
|