So, if you are talking about the difference in the usability aspect, then there is no fundamental difference between CGSize() and CGSizeMake() .
But if you are talking about the structural and programmatic differences between these two points, then the structure and explanation of the code is also presented here.
CGSize()
struct CGSize { var width: CGFloat var height: CGFloat init() init(width width: CGFloat, height height: CGFloat) }
CGSizeMake()
func CGSizeMake(_ width: CGFloat, _ height: CGFloat) -> CGSize
Explanation : -
In the first case here, i.e. CGSize() , the code clearly demonstrates that its structure, which usually takes height and width like CGFloat() , is a distance vector, but not a physical size. As a vector, the value may be negative.
On the other hand, in the case of CGSizeMake() , we can easily understand what its function is, not its structure. It usually takes height and width as CGFloat() and returns a CGSize() structure.
Example : -
CGSize()
var sizeValue = CGSize(width: 20, height: 30)
CGSizeMake()
var sizeValue = CGSizeMake(20,30)
Now in the case of pure quick use and the CGSize() code is much simpler and more understandable than CGSizeMake() . You can get this from the above example correctly .. !!!!
Thanks,
Hope this helps.
source share