Skip to content

Instantly share code, notes, and snippets.

View AKoulabukhov's full-sized avatar
🔮
Hello, SPACE!

Alexander Kulabukhov AKoulabukhov

🔮
Hello, SPACE!
View GitHub Profile
@AKoulabukhov
AKoulabukhov / SheetModalPresentationController.swift
Created April 9, 2021 23:32 — forked from vinczebalazs/SheetModalPresentationController.swift
A presentation controller to use for presenting a view controller modally, which can be dismissed by a pull down gesture. The presented view controller's height is also adjustable.
import UIKit
extension UIView {
var allSubviews: [UIView] {
subviews + subviews.flatMap { $0.allSubviews }
}
func firstSubview<T: UIView>(of type: T.Type) -> T? {
allSubviews.first { $0 is T } as? T