Frame vs bounds in Swift



1Frame

The frame of an UIView is the rectangle, expressed as a location (x,y) and size (width, height) relative to the superview it is contained within.

In shorta view's location and size using the parent view's coordinate system


2Bounds

The bounds of an UIView is the rectangle, expressed as a location (x,y) and size (width, height) relative to its own coordinate system (0,0).

 In shorta view's location and size using its own coordinate system

Example:


Frame
    origin = (40, 60)
    width = 80
    height = 130

Bounds 
    origin = (0, 0)
    width = 80
    height = 130


Thanks for reading, Happy Coding 👨‍💻 

Popular posts from this blog

Property wrapper in Swift

DateFomatter in Swift