how to check if item is last in foreach swift code example
Example: check enumatted arrray last item swift
for (idx, element) in array.enumerated() {
if idx == array.endIndex-1 {
// handling the last element
}
}
for (idx, element) in array.enumerated() {
if idx == array.endIndex-1 {
// handling the last element
}
}