Check out example codes for "check enumatted arrray last item swift". It will help you in understanding the concepts better.

Code Example 1

for (idx, element) in array.enumerated() {
      if idx == array.endIndex-1 {
        // handling the last element
       }
     }

Learn ReactJs, React Native from akashmittal.com