[Accepted] SE-0173: Add MutableCollection.swapAt(_:_:)

Proposal Link: swift-evolution/0173-swap-indices.md at master · apple/swift-evolution · GitHub

The review of “SE-0173: Add MutableCollection.swapAt(_:_:)” (originally named "Add MutableCollection.swap(_:with:)”) ran from April 25...28, 2017.

The proposal is accepted, including the revision to change the method name from “swap(_:with:)” to “swapAt(_:_)” that came out of the Core Team meeting.

The consensus on swift-evolution was to add the method, with division mostly on the naming of the method. The Core Team reviewed the proposed options as well as consulted the API design guidelines to resolve the issue:

Two important points from the guidelines serve to us well here:

  "Omit all labels when arguments can’t be usefully distinguished”


  "When the first argument forms part of a prepositional phrase, give it an argument label...An exception arises when the first two arguments represent parts of a single abstraction….In such cases, begin the argument label after the preposition, to keep the abstraction clear."

The combination of these rules leads to the method name “swapAt(_:_:)”, which the Core Team believes was most in line with the guidelines. The proposal is accepted with this revision.

Thanks to everyone who participated in the review!

  - Ted
  Review Manager