ios - For loop based on array length in Swift -



ios - For loop based on array length in Swift -

i have been trying take length of array , utilize length set amount of times loop should execute. code:

if notes.count != names.count { notes.removeallobjects() var namearraylength = names.count index in namearraylength { notes.insertobject("", atindex: (index-1)) } }

at moment error:

int not have fellow member named 'generator'

seems simple issue, haven't yet figured out solution. ideas?

you need specify range. if want include namearraylength:

for index in 1...namearraylength { }

if want stop 1 before namearraylength:

for index in 1..<namearraylength { }

ios for-loop swift

Comments

Popular posts from this blog

php - How to pass multiple values from url -

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

database - php search bar when I press submit with nothing in the search bar it shows all the data -