Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialEdward Bromley
3,353 PointsDeprecation of ++ and --
It appears that Apple plans to remove these operators. https://github.com/apple/swift-evolution/blob/master/proposals/0004-remove-pre-post-inc-decrement.md
Should the video reflect this?
1 Answer
Michael Hulet
47,913 PointsThe ++
and --
operators are deprecated in the latest version of Swift, and will be removed entirely in Swift 3.0, coming this Fall (assuming you live in the Northern Hemisphere. Otherwise, Spring). That being said, Swift is still a rapidly evolving language, and will continue to be as such for a long time, though a lot of stuff should be finalized with Swift 3, because that update will come with ABI stabilization. Because of that, my personal vote is towards adding teachers notes right now, and then recording new videos with Swift 3
Nathan Wong
7,129 PointsNow that Swift 2.2 has been released, it would probably be good for the teacher's notes to be updated. It would be nice if the associated task were updated to support the alternative syntax as well.
Laura Ross
Courses Plus Student 2,449 PointsI agree with Nathan. I can't figure out how += 1 is replacing ++. The auto-fixes suggested by the compiler are
x = ++b is now x = b += 1
and
x = b++ is now x = b += 1
Can someone explain the correct replacement?
Michael Hulet
47,913 PointsI wrote a far more detailed answer over here
Sebastian Nitu
8,616 PointsSebastian Nitu
8,616 PointsYes, that is correct. Starting with Swift 2.2, the postfix operators ++ and -- will be depricated.
You can learn more about the upcoming Swift changes here: http://ericasadun.com/2015/12/03/changing-swift-whats-coming-up-in-2-2-and-3-0/