Skip to content

Instantly share code, notes, and snippets.

@zontan
Created September 23, 2019 18:54
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 zontan/a727eb0a20d45f4ac432245e88209569 to your computer and use it in GitHub Desktop.
Save zontan/a727eb0a20d45f4ac432245e88209569 to your computer and use it in GitHub Desktop.
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let userData = resultsArray[indexPath.row]
performSegue(withIdentifier: "startCall", sender: userData)
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
if segue.identifier == "startCall" {
guard let userData = sender as? [String: String] else {
assert(false, "startCall segue triggered improperly")
return
}
if let videoController = segue.destination as? AgoraVideoViewController {
let uids = [currentUser?.uid ?? "", userData["uid"] ?? ""].sorted { $0 < $1 }
let channelName = uids[0] + uids[1]
videoController.setChannelName(channel: channelName)
videoController.setUserName(name: currentUser?.displayName)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment