userList is array of objects [User]
userID is identity of object, which is use for filter
See bellow method, In this method filtered the userList array by userID. get all users which are having same userID.
func filtered(userID: String) -> [User] {
if userList.count > 0{
let filteredArray = userList.filter { (obj) -> Bool in
obj.userID == userID
}
return filteredArray
}
return []
}
No comments:
Post a Comment