Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine M. Ricardo, Susan D. Urban, Karen C. Davis

4th Edition

1284231585, 978-1284231588

More Books

Students also viewed these Databases questions