Reactant
Reactant copied to clipboard
Add method for removing all views from a superview.
This is quite useful when working with our stack
and UIStackView
.
extension UIView {
@discardableResult
public func removeSubviews() -> [UIView] {
let subviews = self.subviews
for subview in subviews {
subview.removeFromSuperview()
}
return subviews
}
}
What use is returning the removed views?