Variable 'xxx' was never mutated, consider changing to 'let'

前端 未结 5 1103
北荒
北荒 2020-12-17 10:40

Updated to xcode7-beta I run across a new kind of warning. Here is my code

override func layoutAttributesForElementsInRect(rect: CGRect) -&g         


        
5条回答
  •  南笙
    南笙 (楼主)
    2020-12-17 11:30

    Your code implies that attributes could be mutated if self.layoutInfo is non nil

    Perhaps the warning is saying that no path leads to self.layoutInfo being non nil and hence attributes has no need of being a var.

    Examine what conditions if any can lead to self.layoutInfo having data

提交回复
热议问题