mirror of
https://github.com/yattee/yattee.git
synced 2024-11-10 00:08:21 +00:00
28 lines
677 B
Swift
28 lines
677 B
Swift
import Defaults
|
|
import SwiftUI
|
|
|
|
struct Player: NSViewControllerRepresentable {
|
|
@EnvironmentObject<PlayerModel> private var player
|
|
|
|
var controller: PlayerViewController?
|
|
|
|
init(controller: PlayerViewController? = nil) {
|
|
self.controller = controller
|
|
}
|
|
|
|
func makeNSViewController(context _: Context) -> PlayerViewController {
|
|
if self.controller != nil {
|
|
return self.controller!
|
|
}
|
|
|
|
let controller = PlayerViewController()
|
|
|
|
controller.playerModel = player
|
|
player.controller = controller
|
|
|
|
return controller
|
|
}
|
|
|
|
func updateNSViewController(_: PlayerViewController, context _: Context) {}
|
|
}
|