Fix manage object context in tvOS info view controllers

This commit is contained in:
Arkadiusz Fal 2022-01-06 17:06:03 +01:00
parent e159bb772c
commit 792db567ed
2 changed files with 4 additions and 0 deletions

View File

@ -10,6 +10,8 @@ final class PlayerViewController: UIViewController {
var subscriptionsModel: SubscriptionsModel! var subscriptionsModel: SubscriptionsModel!
var playerView = AVPlayerViewController() var playerView = AVPlayerViewController()
let persistenceController = PersistenceController.shared
#if !os(tvOS) #if !os(tvOS)
var aspectRatio: Double? { var aspectRatio: Double? {
let ratio = Double(playerView.videoBounds.width) / Double(playerView.videoBounds.height) let ratio = Double(playerView.videoBounds.width) / Double(playerView.videoBounds.height)
@ -95,6 +97,7 @@ final class PlayerViewController: UIViewController {
.environmentObject(commentsModel) .environmentObject(commentsModel)
.environmentObject(playerModel) .environmentObject(playerModel)
.environmentObject(subscriptionsModel) .environmentObject(subscriptionsModel)
.environment(\.managedObjectContext, persistenceController.container.viewContext)
) )
) )

View File

@ -8,6 +8,7 @@ struct TVNavigationView: View {
@EnvironmentObject<RecentsModel> private var recents @EnvironmentObject<RecentsModel> private var recents
@Default(.visibleSections) private var visibleSections @Default(.visibleSections) private var visibleSections
var body: some View { var body: some View {
TabView(selection: navigation.tabSelectionBinding) { TabView(selection: navigation.tabSelectionBinding) {
if visibleSections.contains(.favorites) { if visibleSections.contains(.favorites) {