Caps-iOS/CapCollector/Extensions/UIViewExtensions.swift

24 lines
577 B
Swift
Raw Normal View History

2018-08-16 11:18:27 +02:00
//
// UIViewExtensions.swift
// CapFinder
//
// Created by User on 23.03.18.
// Copyright © 2018 User. All rights reserved.
//
import Foundation
import UIKit
extension UIView {
var recursiveSubviews: [UIView] {
var subviews = self.subviews.compactMap{ $0 }
subviews.forEach { subviews.append(contentsOf: $0.recursiveSubviews) }
return subviews
}
2020-05-16 11:21:55 +02:00
func fromNib<T : UIView>() -> T { // 2
return Bundle(for: type(of: self)).loadNibNamed(String(describing: type(of: self)), owner: self, options: nil)!.first! as! T
}
2018-08-16 11:18:27 +02:00
}