Answers for "swift loop through array"

3

loop through array swift

let names = ["a", "b", "c"]

for name in names {
    print(name)
}
Posted by: Guest on June-16-2020
4

swift loop through array

guard let currentUser = currentUser, 
    let photos = currentUser.photos as? [ModelAttachment] else 
{
    // break or return
}
// now 'photos' is available outside the guard
for object in photos {
    let url = object.url
}
Posted by: Guest on March-04-2020
1

swift loop through array

for object in array {
	// object is replaced with the array item for each loop
}
Posted by: Guest on January-20-2021

Code answers related to "Swift"

Browse Popular Code Answers by Language