From the UIStackView Class Reference
In removeArrangedSubview:
To prevent the view from appearing on screen after calling the stack’s removeArrang
No, To remove specific view.
func removeArrangedSubview(_ view: UIView)
To remove all subviews
stackView.arrangedSubviews.forEach { $0.removeFromSuperview() }