Skip to content

Instantly share code, notes, and snippets.

@Deub27
Deub27 / UIStackView+removeAll.swift
Created November 25, 2017 14:00
Remove all arranged subviews from UIStackView at once
import UIKit
extension UIStackView {
func removeAllArrangedSubviews() {
let removedSubviews = arrangedSubviews.reduce([]) { (allSubviews, subview) -> [UIView] in
self.removeArrangedSubview(subview)
return allSubviews + [subview]
}