From d5f8e35430d334ad750be3e9a45fbea997b552b6 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Sun, 21 May 2023 17:17:56 +0200 Subject: [PATCH] Fix channel videos horizontal layout --- Shared/Channels/ChannelVideosView.swift | 2 +- Shared/Videos/VerticalCells.swift | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Shared/Channels/ChannelVideosView.swift b/Shared/Channels/ChannelVideosView.swift index 0a8edf87..c4a511b8 100644 --- a/Shared/Channels/ChannelVideosView.swift +++ b/Shared/Channels/ChannelVideosView.swift @@ -66,7 +66,7 @@ struct ChannelVideosView: View { .frame(maxWidth: .infinity) #endif - VerticalCells(items: contentItems) { + VerticalCells(items: contentItems, edgesIgnoringSafeArea: .init()) { if let description = presentedChannel?.description, !description.isEmpty { Button { withAnimation(.spring()) { diff --git a/Shared/Videos/VerticalCells.swift b/Shared/Videos/VerticalCells.swift index ed91e859..77cb6cdd 100644 --- a/Shared/Videos/VerticalCells.swift +++ b/Shared/Videos/VerticalCells.swift @@ -12,11 +12,13 @@ struct VerticalCells: View { var items = [ContentItem]() var allowEmpty = false + var edgesIgnoringSafeArea = Edge.Set.horizontal let header: Header? - init(items: [ContentItem], allowEmpty: Bool = false, @ViewBuilder header: @escaping () -> Header? = { nil }) { + init(items: [ContentItem], allowEmpty: Bool = false, edgesIgnoringSafeArea: Edge.Set = .horizontal, @ViewBuilder header: @escaping () -> Header? = { nil }) { self.items = items self.allowEmpty = allowEmpty + self.edgesIgnoringSafeArea = edgesIgnoringSafeArea self.header = header() } @@ -40,7 +42,7 @@ struct VerticalCells: View { #endif } .animation(nil) - .edgesIgnoringSafeArea(.horizontal) + .edgesIgnoringSafeArea(edgesIgnoringSafeArea) #if os(macOS) .background(Color.secondaryBackground) .frame(minWidth: 360)