I am beginner with the Swift
having no advance knowledge with operators.
I have the following class
class Container {
var list: [Any] = [];
}
I want to implement the operator subscript []
in order to access the data from list
.
I need something like this:
var data: Container = Container()
var value = data[5]
// also
data[5] = 5
Also I want to be able to write something like this:
data[1][2]
Is it possible considering that element 1
from Container
is an array
?
Thanx for help.