2021-09-25 13:48:22 +05:30
|
|
|
import Defaults
|
2021-07-19 04:02:46 +05:30
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
struct Player: NSViewControllerRepresentable {
|
2021-10-06 01:50:09 +05:30
|
|
|
@EnvironmentObject<PlayerModel> private var player
|
2021-07-19 04:02:46 +05:30
|
|
|
|
2021-10-06 01:50:09 +05:30
|
|
|
var controller: PlayerViewController?
|
|
|
|
|
|
|
|
init(controller: PlayerViewController? = nil) {
|
|
|
|
self.controller = controller
|
|
|
|
}
|
2021-09-25 13:48:22 +05:30
|
|
|
|
2021-07-19 04:02:46 +05:30
|
|
|
func makeNSViewController(context _: Context) -> PlayerViewController {
|
2021-10-06 01:50:09 +05:30
|
|
|
if self.controller != nil {
|
|
|
|
return self.controller!
|
|
|
|
}
|
2021-08-23 00:43:33 +05:30
|
|
|
|
2021-10-06 01:50:09 +05:30
|
|
|
let controller = PlayerViewController()
|
2021-09-25 13:48:22 +05:30
|
|
|
|
2021-10-06 01:50:09 +05:30
|
|
|
controller.playerModel = player
|
2021-10-14 03:40:29 +05:30
|
|
|
player.controller = controller
|
2021-07-19 04:02:46 +05:30
|
|
|
|
|
|
|
return controller
|
|
|
|
}
|
|
|
|
|
|
|
|
func updateNSViewController(_: PlayerViewController, context _: Context) {}
|
|
|
|
}
|