class Container
{
var list: [AnyObject] = ["hello" , "world"];
subscript ( i : Int) -> AnyObject{
get{
return list[i]
}
set{
list[i] = newValue
}
}
}
var c : Container = Container()
println(c[1])
c[1] = "lol"
println(c[1])
For more information about operator : http://nshipster.com/swift-operators/