I have an array of a struct and I have to modify a property inside the struct whenever user switch between each index of the SegmentControl, for example:
// Struct
struct User {
var name: String
var age:Int }
// Array
var arrayUser = [User(name: "Alex", age: 23]
// Modify an array
arrayUser[0].age = 19
Will the array create a new copy every time I modify like this or it just reference to that particular element and make a modification?
Your response would be highly appreciated :)
// Struct
struct User {
var name: String
var age:Int }
// Array
var arrayUser = [User(name: "Alex", age: 23]
// Modify an array
arrayUser[0].age = 19
Will the array create a new copy every time I modify like this or it just reference to that particular element and make a modification?
Your response would be highly appreciated :)