tvOS layout improvements

This commit is contained in:
Arkadiusz Fal
2022-08-14 18:59:04 +02:00
parent 9a958113c4
commit 60a52bc12e
5 changed files with 52 additions and 21 deletions

View File

@@ -10,6 +10,8 @@ struct TVNavigationView: View {
@Default(.visibleSections) private var visibleSections
@State private var playerInitialized = false
var body: some View {
NavigationView {
TabView(selection: navigation.tabSelectionBinding) {
@@ -52,11 +54,11 @@ struct TVNavigationView: View {
.tag(TabSelection.search)
SettingsView()
.navigationBarHidden(true)
.tabItem { Image(systemName: "gear") }
.tag(TabSelection.settings)
}
}
.background(videoPlayerInitialize)
.fullScreenCover(isPresented: $navigation.presentingAddToPlaylist) {
if let video = navigation.videoToAddToPlaylist {
AddToPlaylistView(video: video)
@@ -76,6 +78,18 @@ struct TVNavigationView: View {
}
}
}
@ViewBuilder var videoPlayerInitialize: some View {
if !playerInitialized {
VideoPlayerView()
.scaleEffect(0.00001)
.onAppear {
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
playerInitialized = true
}
}
}
}
}
struct TVNavigationView_Previews: PreviewProvider {