UIView에서 하위의 subviews 찾아서 배열을 리턴
import UIKit
extension UIView
{
func findSubViews<T: UIView>(classOf: T.Type) -> [T] {
return recursiveSubviews.compactMap { $0 as? T }
}
var recursiveSubviews: [UIView] {
return subviews + subviews.flatMap { $0.recursiveSubviews }
}
}