I recently re-visited a question in and noticed that all code from the question and the answers doesn't compile anymore with the current Swift 2.1 release that comes with Xcode 7.2.

The reason is of course that Swift is an evolving language, and incompatible changes were made between releases (in particular in the transition to Swift 1.2/Xcode 6.3 and Swift 2.0/Xcode 7). These changes range from

  • "minor changes", such as renaming println to print, over
  • "medium changes", such as replacing most global function by protocol extension methods, i.e. map(array, ...) becomes array.map(...), to
  • "major changes", such as a completely new error handling model (throw/try/catch).

I wonder if this should have any effect on existing questions and answers. I assume that the answer is "NO", because

  • we must not change the question, and
  • each answer refers to the code as it was posted in the question.

The disadvantage however is that future visitors cannot copy/paste code from the answers into their project. Is there any recommendation how this could be handled?

I don't have the intention to edit all my Swift answers with each new Swift/Xcode release, but if I re-visit an answer (e.g. due to a voting change or comment), is there anything sensible that I can/should do?

Update: I am aware that the problem is not restricted to the Swift language (as pointed out in Quill's answer). One thing that might be different compared to other programming languages is that many (most?) Apple developers will install only the latest Xcode because

  • \$\begingroup\$ Like Quill suggests, if you're going to edit an old answer anyway, I'd just add a caveat à la "Note: This pertains to an older, deprecated version of Swift, etc." and maybe include a link to the version history. That could help people out. \$\endgroup\$
    – Flambino
    Commented Dec 23, 2015 at 4:17
  • \$\begingroup\$ "The disadvantage however is that future visitors cannot copy/paste code from the answers into their project." Code Review is about sharing knowledge, not about sharing code. \$\endgroup\$
    – Mast Mod
    Commented Dec 26, 2015 at 14:51

1 Answer 1


Deprecated functions are not a new thing, and not a thing solely to . You don't need to edit every question to replace println, you simply need to understand those questions/answers contain old code.

Python went and changed from print statement to print(statement), and the existing questions weren't edited. Granted that the changes from Python 2.7 to 3 were a little larger.

What I would suggest, if you really want to, is that you can edit your old answers and say 'X function is deprecated, replaced with Y function'.

That is common for some SO posts, but it really isn't necessary here.

  • 2
    \$\begingroup\$ Thank you for your answer, that completely makes sense. – I am aware that the problem is not Swift-specific. Since I found no existing answer on CR meta on how to deal with language changes I decided to ask about the specific case here. One thing that might be different compared to other languages (I am not a Python expert) is that Apple more or less forces developers to use the latest compiler tools. (I'll add that to the question.) – I will wait if more opinions come up and then act accordingly. \$\endgroup\$
    – Martin R
    Commented Dec 13, 2015 at 13:36
  • 3
    \$\begingroup\$ You do bring up a good point that Apple forces Xcode updates down the throat of developers. \$\endgroup\$
    – Quill
    Commented Dec 13, 2015 at 13:37
  • 4
    \$\begingroup\$ It might be worth mention that Python includes the version in the tags... But this is something I don't think Swift should do... \$\endgroup\$
    – nhgrif
    Commented Dec 13, 2015 at 15:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .