15

I just came across an 8 year-old answer that was originally posted in Objective-C (the question was in Objective-C and the question is tagged Objective-C). 5 years later (3 years ago), someone rewrote the code into Swift. Since then the answer has had several updates by other users to fix typos and grammar issues. And the code has been updated a few times as Swift has evolved over the years.

This answer was accepted by the OP almost immediately after the original answer was posted. It now has over 440 upvotes.

This answer should never have been rewritten to Swift from Objective-C. But there are enough other fixes that a simple rollback can't be done.

Should I just edit the current answer back to Objective-C or is there a better way to handle this?

There are currently 19 answers on this question including several that are specific to Swift.

4
  • I used to regularly see this happen in the suggested edit queue as well: people replacing Objective-C and Swift answers instead of either appending an update or writing a new answer.
    – BSMP
    Aug 31, 2018 at 14:57
  • 2
    Does the answer answers the question as you would read now (and not how one read question 8 years ago)? (it happened in the past when technology changed enough for meaning of the same question to general population changed so answer that was perfectly valid in the past makes no sense anymore on SO... Maybe migrate question to retrocomputing.SE :) ? ) Aug 31, 2018 at 16:39
  • 3
    both? both is good. There's still plenty of companies using Objective-C more or less exclusively, so finding Objective-C answers to questions are still important. Sep 2, 2018 at 14:07
  • If there is little code, maybe both question and answer could be adapted to cover both languages?
    – Didier L
    Sep 2, 2018 at 14:08

2 Answers 2

17

My argument would be that since the original question was asking about Objective-C, then it would make sense to have the answer not be in Swift.

However, it's dangerous to do a flat rollback of the post since others may want to reference the solution in Swift.

What I would espouse is a Community Wiki answer of the contested answer's current state, then roll back the answer to what it was before.

2
  • One thing I didn't mention is that the answer is only 4 lines of code spread out into three separate sections of the answer. It's trivial code really. And it's actually an out-of-date (but still technically valid) answer due to newer APIs that provide a better solution today. I ended up making a new edit to replace the Swift code with Objective-C. The other answers already provide Swift code so there is no benefit to copying this answer as a Community Wiki answer.
    – rmaddy
    Sep 1, 2018 at 22:59
  • The problem with this approach is that many of those upvotes may have been on the swift answer, and the actual original answer may not have been very good, but would now look very upvoted.
    – Tas
    Sep 3, 2018 at 0:37
5

I would probably just add back the original Objective C code, leaving also the new Swift content. Maybe add a "for new applications being written in Swift, you can instead do...", possibly adding credits to whoever wrote that code. It may not be completely true to the original question history, but given that

  • both the old and the new content attracted interest
  • the new content is being consistently found through that particular question just fine (as testified by the continuous activity you find over it)

I think that keeping them both is good service to the community.

1
  • There's already other answers in Swift so there's no benefit to putting the Swift code in this Objective-C answer. This old answer is not one to emulate in new code. There are much better solutions now so there is no benefit to having the answer in two languages.
    – rmaddy
    Sep 2, 2018 at 23:13

You must log in to answer this question.

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