Swift 2.2 formally deprecates the ++
and --
operators, which means they still work but you'll get a warning when you use them. Deprecation is usually a first step towards removing something entirely, and in this case both of these operators will be removed in Swift 3.0.
In their place, you need to use += 1
and -= 1
instead. These operators have been there all along, and are not going away.
You might wonder why two long-standing operators are being removed, particularly when they exist in C, C#, Java, and – critically to its "joke" – C++. There are several answers, not least:
++
rather than += 1
is hardly a dramatic time saving++
doesn't have an obvious meaning to people learning Swift, whereas +=
at least reads as "add and assign."++
and --
were used – have also been deprecated, which brings me on to my next point…SPONSORED Still waiting on your CI build? Speed it up ~3x with Blaze - change one line, pay less, keep your existing GitHub workflows. First 25 HWS readers to use code HACKING at checkout get 50% off the first year. Try it now for free!
Sponsor Hacking with Swift and reach the world's largest Swift community!
Download all Swift 2.2 changes as a playground Link to Swift 2.2 changes
Link copied to your pasteboard.