Skip to content

Instantly share code, notes, and snippets.

@Krishna21Soni13
Created January 3, 2020 10:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Krishna21Soni13/bf40ac1b03044e46e5a50604c8356d9b to your computer and use it in GitHub Desktop.
Save Krishna21Soni13/bf40ac1b03044e46e5a50604c8356d9b to your computer and use it in GitHub Desktop.
ChatViewModel- To fetch the participant list
func fetchParticipantList(_ name: String) {
SocketHelper.shared.participantList {[weak self] (result: [User]?) in
guard let self = self,
let users = result else{
return
}
var filterUsers: [User] = users
// Removed login user from list
if let index = filterUsers.firstIndex(where: {$0.nickname == name}) {
filterUsers.remove(at: index)
}
self.arrUsers.value = filterUsers
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment