1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-14 14:20:32 +05:30
yattee/Shared/Player/Player.swift
2021-10-25 00:35:58 +02:00

30 lines
713 B
Swift

import Defaults
import SwiftUI
struct Player: UIViewControllerRepresentable {
@EnvironmentObject<PlayerModel> private var player
var controller: PlayerViewController?
init(controller: PlayerViewController? = nil) {
self.controller = controller
}
func makeUIViewController(context _: Context) -> PlayerViewController {
if self.controller != nil {
return self.controller!
}
let controller = PlayerViewController()
controller.playerModel = player
player.controller = controller
return controller
}
func updateUIViewController(_: PlayerViewController, context _: Context) {
player.rebuildTVMenu()
}
}