Answers for "for loop swift thrtough array"

2

swift for loop index

for (index, object) in list.enumerated() {
  print("Item at \(index): \(object)")
}
Posted by: Guest on September-29-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

Code answers related to "Swift"

Browse Popular Code Answers by Language