Detect when the view’s frame changes using Swift

Photo by Charles Deluvio on Unsplash

The very first day of my iOS adventure I’ve learned how to add subviews to view. It is the most basic UI operation. After a while I realized that subviews can change their parent size, It’s pretty obvious, bigger content = bigger container. I encountered situations when I needed to know when exactly it happens and to achieve it I had to add tons of code in many views.