how to remove all subviews using swfit?
i try
let backgroundView = sender.view as UIView?
if let view = backgroundView{
UIView.animate(withDuration: 0.3,
animations:{ () in
},
completion: {(finished:Bool) in
view.alpha = 0
view.superview?.removeFromSuperview()
if view.subviews.count > 0
{
view.subviews.forEach({ $0.removeFromSuperview()})
}
})
}
but only the view removed.
all the subviews cannot be removed....