Recently, Documentation introduced the <!-- version -->
syntax for wrapping an example's code and text. This is very useful for languages like Swift which drop and add a lot between versions.
We've dealt with this on Stack Overflow by using headers, but it would be very nice to have such an encompassing block to make it clear which parts are for which versions, or which parts can be shared across versions.
Examples:
In these, the fundamental answer doesn't change, but the edit history shows that the syntax had been tweaked/updated for the evolving language:
- Swift equivalent of Array.componentsJoinedByString?
- Any way to replace characters on Swift String?
- How do I get a reference to the app delegate in Swift?
- swift for loop: for index, element in array?
- Get nth character of a string in Swift programming language
- How do I shuffle an array in Swift?
- How to use substringToIndex in Swift?
- Swift: How to expand a tilde in a path String
Note also that I just found these with a cursory search, only within Swift since that's what I encounter in my day-to-day, and there are hundreds of other examples around the site.