2

After converting my source code to Swift 2.0, I have got 999+ warnings out of which more than 500 warnings will be "Variable abc was never mutated, consider changing it to let". Is there a way to fix all these warnings at a single shot? Going line by line and fixing this warning takes huge time.

Atleast Apple should have automatically updated while converting to Swift 2.0.

Coder
  • 1,661
  • 4
  • 27
  • 50

3 Answers3

3

Here is a thought: Globally change all var to let and then revert the errors, my guess is that there will be fewer to change.

zaph
  • 111,848
  • 21
  • 189
  • 228
2

You could search and replace all occurrences of var with let and see if that returns fewer errors.

There is no optimize functionality if that is what your are looking for.

Wyetro
  • 8,439
  • 9
  • 46
  • 64
der_michael
  • 3,151
  • 1
  • 24
  • 43
2

at least you can use the Fix all in Scope functionality of xcode to batch convert the variables to constants (Editor -> Fix all in scope)

Sierra101
  • 251
  • 3
  • 12