In several cases of my old code I am getting the warning:
Immutable value X is never used consider replacing with '_'
For instance this often occurs if I am checking an enum which has an associated object (but I don't use the object in this case) - or if I am using the 'If let' construct to check if an object is nil or not.
A. These changes are recommended because if you don't use these variables at all you should consider replacing it with '_'. So you (and other people) can later understand your intention more quickly.
In terms of performance it would probably be just a minor improvement which you can't notice at all. The same situation applies during compilation and optimization of your code.
stackoverflow.com/questions/31002288/swift-2-immutable-value-x-is-never-used-consider-replacing-with
Swift 2: Immutable value X is never used consider replacing with '_'
In several cases of my old code I am getting the warning: Immutable value X is never used consider replacing with '_' For instance this often occurs if I am checking an enum which has an associ...
stackoverflow.com
'Programming > Swift' 카테고리의 다른 글
round number to 2 decimal places (0) | 2021.01.13 |
---|---|
make a countdown with NSTimer? (0) | 2021.01.12 |
iOS: Tracking Visited Locations (0) | 2021.01.08 |
Article: Choosing the Location Services Authorization to Request (0) | 2021.01.08 |
Class: AVAudioPlayer (0) | 2021.01.07 |