This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
import UIKit | |
var hasTopNotch: Bool { | |
if #available(iOS 11.0, *) { | |
// with notch: 44.0 on iPhone X, XS, XS Max, XR. | |
// without notch: 24.0 on iPad Pro 12.9" 3rd generation, 20.0 on iPhone 8 on iOS 12+. | |
return UIApplication.shared.windows.filter {$0.isKeyWindow}.first?.safeAreaInsets.top ?? 0 > 24 | |
} else{ | |
return UIApplication.shared.delegate?.window??.safeAreaInsets.top ?? 0 > 24 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// UIScrollViewWrapper.swift | |
// | |
// Created by Justin Schwartz on 12/29/20. | |
// | |
import SwiftUI | |
import UIKit | |
struct UIScrollViewWrapper<Content: View>: UIViewControllerRepresentable { |