check enumatted arrray last item swift
for (idx, element) in array.enumerated() {
if idx == array.endIndex-1 {
// handling the last element
}
}
check enumatted arrray last item swift
for (idx, element) in array.enumerated() {
if idx == array.endIndex-1 {
// handling the last element
}
}
how to get last element of an array in swifg
let myArray = ["Hello!", "World!"]
let capacity = myArray.count
let lastElement = myArray[capacity-1]
print(lastElement)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us