How to use index(of: Object) subscript for array of models to replace the object at index? : If there is an `Array` as below containing `User` instances.

    class User {
         var id: String
         var name: String
    
        init(id: String, name: String) {
         self.id = id
         self.name = name
        }
    }

Now if there are 5 user models having ids from 1 to 5 and are stored in the array as below (no matter what the name is)

    var userModels = [user1,user2,user3,user4,user5]

Now suppose there is an instance I am creating manually with id ```1```

    let latestUser = User(id: "1", name: "Updated Name") //id 1 is already there but this is the updated model
    
is there any way to find the index of the user model whose index is 1 without `filter` so that I can replace the instance like this

Using Array extension or anything.Can we have the constraint for ```index(of: )``` for property id ???

    let indexOfUser1 = userModels.index(of: latestUser) // It should return 1.

Like this (as we do the `subscript`)

    extension Array where Element: User { 
       //TODO: indexOf constraint for specific property

    }