Pattern: Use explicit init with zero parameters
Issue: -
Prefer .zero
over explicit init with zero parameters (e.g. CGPoint(x: 0, y: 0)
).
Examples of correct code:
CGRect(x: 0, y: 0, width: 0, height: 1)
CGPoint(x: 0, y: -1)
CGSize(width: 2, height: 4)
CGVector(dx: -5, dy: 0)
Examples of incorrect code:
↓CGPoint(x: 0, y: 0)
↓CGPoint(x: 0.000000, y: 0)
↓CGPoint(x: 0.000000, y: 0.000)
↓CGRect(x: 0, y: 0, width: 0, height: 0)
↓CGSize(width: 0, height: 0)
↓CGVector(dx: 0, dy: 0)