swift 5 foreach code example
Example 1: swiftui foreach
ForEach(1...5) { row in
Text("Row \(row)")
}
Example 2: foreach swift
let numbers = [1, 2, 3, 4, 5]
for number in numbers {
print(number)
}
ForEach(1...5) { row in
Text("Row \(row)")
}
let numbers = [1, 2, 3, 4, 5]
for number in numbers {
print(number)
}