iOS Swift 5 Tutorial: Superview and Subviews in iOS Hindi 2020.

seen from Jordan
seen from Spain

seen from United States

seen from Canada
seen from United States
seen from United States
seen from United States

seen from China

seen from United States
seen from China
seen from China
seen from United States

seen from United States
seen from Singapore

seen from United States

seen from United States
seen from United States
seen from China

seen from Jordan

seen from United States
iOS Swift 5 Tutorial: Superview and Subviews in iOS Hindi 2020.
When my app gets back to its root view controller, in the viewDidAppear: method I need to remove all subviews. How can I do this?
original source : https://stackoverflow.com/questions/2156015/remove-all-subviews
In Swift you can use a functional approach like this:
view.subviews.forEach { $0.removeFromSuperview() }
As a comparison, the imperative approach would look like this:
for subview in view.subviews { subview.removeFromSuperview() }
These code snippets only work in iOS / tvOS though, things are a little different on macOS.