iterating over array swift code example
Example 1: loop through array swift
let names = ["a", "b", "c"]
for name in names {
print(name)
}
Example 2: 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
}