From 0fa0518f0a1b0e66c46fa9f905b04901df5a2568 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Fri, 9 Jul 2021 17:24:13 +0200 Subject: [PATCH] Fix videos layout for focusing --- Apple TV/VideosCellsView.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Apple TV/VideosCellsView.swift b/Apple TV/VideosCellsView.swift index 7f78273f..a9bc76c9 100644 --- a/Apple TV/VideosCellsView.swift +++ b/Apple TV/VideosCellsView.swift @@ -15,7 +15,7 @@ struct VideosCellsView: View { var body: some View { ScrollView(.vertical, showsIndicators: false) { - LazyVGrid(columns: items, spacing: 10) { + LazyVGrid(columns: items, alignment: .center, spacing: 10) { ForEach(videos) { video in VideoCellView(video: video) .contextMenu { VideoContextMenuView(video: video) } @@ -26,6 +26,10 @@ struct VideosCellsView: View { } var items: [GridItem] { - Array(repeating: .init(.fixed(600)), count: columns) + Array(repeating: .init(.fixed(600)), count: gridColumns) + } + + var gridColumns: Int { + videos.count < columns ? videos.count : columns } }