Updated to xcode7-beta I run across a new kind of warning. Here is my code
override func layoutAttributesForElementsInRect(rect: CGRect) -&g
By declaring a constant with let
, you ensure that it can never be changed. This is good for making sure that you don't accidentally change it later, and it (in theory) can help the optimizer generate faster code.
If you declare a variable with var
, and you don't intend to change it or call mutating methods on it, using let
instead helps you enforce that contract.