diff --git a/damus/Components/ImageCarousel.swift b/damus/Components/ImageCarousel.swift index ffa7005f..e724f47a 100644 --- a/damus/Components/ImageCarousel.swift +++ b/damus/Components/ImageCarousel.swift @@ -127,14 +127,6 @@ struct ImageView: View { @State private var selectedIndex = 0 @State var showMenu = true - var safeAreaInsets: UIEdgeInsets? { - return UIApplication - .shared - .connectedScenes - .flatMap { ($0 as? UIWindowScene)?.windows ?? [] } - .first { $0.isKeyWindow }?.safeAreaInsets - } - var navBarView: some View { VStack { HStack { @@ -180,8 +172,8 @@ struct ImageView: View { ZoomableScrollView { ImageContainerView(url: urls[index]) .aspectRatio(contentMode: .fit) - .padding(.top, safeAreaInsets?.top) - .padding(.bottom, safeAreaInsets?.bottom) + .padding(.top, Theme.safeAreaInsets?.top) + .padding(.bottom, Theme.safeAreaInsets?.bottom) } .modifier(SwipeToDismissModifier(minDistance: 50, onDismiss: { presentationMode.wrappedValue.dismiss() @@ -210,7 +202,7 @@ struct ImageView: View { } } .animation(.easeInOut, value: showMenu) - .padding(.bottom, safeAreaInsets?.bottom) + .padding(.bottom, Theme.safeAreaInsets?.bottom) ) } } diff --git a/damus/Util/Theme.swift b/damus/Util/Theme.swift index 1b550c08..91db759f 100644 --- a/damus/Util/Theme.swift +++ b/damus/Util/Theme.swift @@ -25,4 +25,12 @@ class Theme { UINavigationBar.appearance().tintColor = tintColor ?? titleColor ?? .black } + + static var safeAreaInsets: UIEdgeInsets? { + return UIApplication + .shared + .connectedScenes + .flatMap { ($0 as? UIWindowScene)?.windows ?? [] } + .first { $0.isKeyWindow }?.safeAreaInsets + } }