From the UIStackView Class Reference
In removeArrangedSubview:
To prevent the view from appearing on screen after calling the stack’s removeArrang
In iOS 12.0, You need to use
stackView.arrangedSubviews[index].removeFromSuperview()
If you use removeArrangedSubview, there is a bug where the view at the specified index removed, but the view I want to clear appears at CGPoint(x: 0, y: 0).
removeArrangedSubview
CGPoint(x: 0, y: 0)
Hope this help someone.