i have objects
var person1 = Person()
person1.name = \"Joe\"
person1.lastName = \"Doe\"
person1.age = 21
var person2 = Person()
person2.name = \"Julia\"
person2
Iterating can be done as in @Rachel's answer. However there are different ways of doing the same thing, and not necessarily by iterating - and in some cases with just one line of code.
If you want to find, then the best way is using the array's filter
method - but before that the multi dimensional array should be flattened, using flatMap
.
So, to find the first element having a certain name, you can simply do:
let result: Person? = array.flatMap { $0 }.filter { $0.name == "Masha" }.first