Swift 3及更高版本
您可以
offsetBy:从
.startIndex:
let mySet: Set = ["a", "b", "c", "d"]mySet[mySet.index(mySet.startIndex, offsetBy: 2)] // -> something from the set.
Swift 2(已淘汰)
您可以
advancedBy()从
.startIndex:
let mySet: Set = ["a", "b", "c", "d"]mySet[mySet.startIndex.advancedBy(2)] // -> something from the set.
Swift 1.x(已淘汰)
与相似
String,您必须
advance()从
.startIndex:
let mySet: Set = ["a", "b", "c", "d"]mySet[advance(mySet.startIndex, 2)] // -> something from the set.



