userList is array of objects [User]
userID is identity of object, which is use for find index.
let userID = "1"
let tempIndex = userList.index(where: { (user: User) -> Bool in
user.userID == userID
})
This blog will help developer to fix time consuming issues within a minute.