I am completely new in swift and iOS developing. I want to initialize this array
I defined the array like this when my class starts
var i = 0
var ArrayTitle = [NSString]()
and then I need to initialize it in one of the functions like this
let ArrayTitl[i] = "text"
and I checked it even like this but the error is same
let ArrayTitl[0] = "text"
but it has this Error
Cannot assign to immutable expression of type '[Int]'
Appreciate any help. thanks
You are using a dynamic array so you need to append the value.
Here's a small exemple:
var arrayTitle = [String]()
arrayTitle.append("text")
print(arrayTitle[0]);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With