1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-15 23:00:32 +05:30
yattee/macOS/Player.swift

28 lines
692 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: NSViewControllerRepresentable {
@EnvironmentObject<PlayerModel> private var player
2021-07-19 04:02:46 +05:30
@State private 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 {
if self.controller != nil {
return self.controller!
}
2021-08-23 00:43:33 +05:30
let controller = PlayerViewController()
2021-09-25 13:48:22 +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) {}
}