Question: Append variables to an array using swift I have 100 variables of type UITextField that are named as such box00, box01, box02 ........ box99 I

Append variables to an array using swift

I have 100 variables of type UITextField that are named as such

box00, box01, box02 ........ box99

I would like to assign to each of these boxes something, however I am stuck. I tried to programmatically stuff them all in an array but I am stuck with that as well.

When using a counter in the variable name my compiler doesn't recognize the variable. I tried making a nested for loop.

for i in 0...9{ for j in 0...9{ boxArray.append(box\(i)\(j)) } }

Any ideas what I do now that I'm in this situation? I want all of my 100 UITextField variables appended in an array without explicitly naming each one by one.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!