1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-13 22:00:31 +05:30
yattee/Shared/Player/Player.swift

32 lines
824 B
Swift
Raw Normal View History

2021-09-25 13:48:22 +05:30
import Defaults
2021-07-19 04:02:46 +05:30
import SwiftUI
struct Player: UIViewControllerRepresentable {
2021-10-28 22:44:55 +05:30
@EnvironmentObject<NavigationModel> private var navigation
@EnvironmentObject<PlayerModel> private var player
2021-08-24 03:01:51 +05:30
var controller: PlayerViewController?
init(controller: PlayerViewController? = nil) {
self.controller = controller
}
2021-07-19 04:02:46 +05:30
func makeUIViewController(context _: Context) -> PlayerViewController {
if self.controller != nil {
return self.controller!
}
2021-07-19 04:02:46 +05:30
let controller = PlayerViewController()
2021-08-23 00:43:33 +05:30
2021-10-28 22:44:55 +05:30
controller.navigationModel = navigation
controller.playerModel = player
2021-10-17 04:18:58 +05:30
player.controller = controller
2021-07-19 04:02:46 +05:30
return controller
}
2021-10-25 03:56:25 +05:30
func updateUIViewController(_: PlayerViewController, context _: Context) {
player.rebuildTVMenu()
}
2021-07-19 04:02:46 +05:30
}