Skip to content

Instantly share code, notes, and snippets.

View schwjustin's full-sized avatar

Justin Schwartz schwjustin

View GitHub Profile
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
//
// UIScrollViewWrapper.swift
//
// Created by Justin Schwartz on 12/29/20.
//
import SwiftUI
import UIKit
struct UIScrollViewWrapper<Content: View>: UIViewControllerRepresentable {