From a8f8a93efc22849f65b48d36f29498091d926c9b Mon Sep 17 00:00:00 2001 From: jhays Date: Thu, 28 Apr 2022 14:27:52 -0500 Subject: [PATCH] sizing --- Swiftfin/Views/LiveTVChannelsView.swift | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Swiftfin/Views/LiveTVChannelsView.swift b/Swiftfin/Views/LiveTVChannelsView.swift index 02b03e2b..5a978812 100644 --- a/Swiftfin/Views/LiveTVChannelsView.swift +++ b/Swiftfin/Views/LiveTVChannelsView.swift @@ -88,7 +88,7 @@ struct LiveTVChannelsView: View { private func createGridLayout() -> NSCollectionLayoutSection { if UIDevice.current.userInterfaceIdiom == .pad { let itemSize = NSCollectionLayoutSize( - widthDimension: .absolute((UIScreen.main.bounds.width / 2) - 2), + widthDimension: .absolute((UIScreen.main.bounds.width / 2) - 16), heightDimension: .fractionalHeight(1) ) let item = NSCollectionLayoutItem(layoutSize: itemSize) @@ -133,8 +133,16 @@ struct LiveTVChannelsView: View { let section = NSCollectionLayoutSection(group: group) return section } else { + + let scenes = UIApplication.shared.connectedScenes + let windowScene = scenes.first as? UIWindowScene + var width = (UIScreen.main.bounds.width / 2) - 32 + if let safeArea = windowScene?.keyWindow?.safeAreaInsets { + width = (UIScreen.main.bounds.width / 2) - safeArea.left - safeArea.right + } + let itemSize = NSCollectionLayoutSize( - widthDimension: .fractionalWidth(0.49), + widthDimension: .absolute(width), heightDimension: .fractionalHeight(1) ) let item = NSCollectionLayoutItem(layoutSize: itemSize)