CGRectZero vs CGRect.zeroRect? CGRectZero vs CGRect.zeroRect? swift swift

CGRectZero vs CGRect.zeroRect?


UPDATE2

In Swift 3, CGRectZero is no longer available. CGRect.zero is your only choice. Learn it, know it, live it.

UPDATE

CGRect.zeroRect was renamed to CGRect.zero in iOS 9.0. That is close enough to CGRectZero (and the same number of keystrokes, counting shift as a keystroke) that I'd recommend CGRect.zero to anyone who's not an Objective-C coder in the habit of using CGRectZero.

ORIGINAL

There's no particular reason to favor one or the other. You should use whichever style you or your team prefers.

Personally, I'd use CGRectZero because it's shorter and I'm used to it from Objective-C.

I'd go with CGRectMake for the same reason.

I'd probably use UIEdgeInsets(top:left:bottom:right:) because I rarely see instances of UIEdgeInsets, so I'm less likely to remember the order of the arguments in UIEdgeInsetsMake. (You get placeholders for it when you're typing in a call to UIEdgeInsetsMake, but when you're reading existing code there's no hints about the argument order.)