Skip to content

Instantly share code, notes, and snippets.

View dterekhov's full-sized avatar

Dmitry Terekhov dterekhov

  • Russia, Voronezh
View GitHub Profile
@yspreen
yspreen / DictionaryKeyPath.swift
Last active November 30, 2022 22:41 — forked from dfrib/DictionaryKeyPath.swift
Swift: Reading and writing to (possible) nested dictionaries for a given key path, using a recursive approach
/*
Copyright 2022 @yspreen
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@vinczebalazs
vinczebalazs / SheetModalPresentationController.swift
Last active February 1, 2024 04:40
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