123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- import UIKit
- import GoogleSignIn
- class SideMenuTableViewController: UITableViewController {
- override func viewDidLoad() {
- super.viewDidLoad()
-
-
-
-
- }
-
- @objc func dismissMenu(sender: UIButton) {
- dismiss(animated: true, completion: nil)
- }
-
- override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
-
- return 3
- }
- override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
- if indexPath.row == 0 {
- guard let cell = tableView.dequeueReusableCell(withIdentifier: "MenuLogoTableViewCell", for: indexPath) as? MenuLogoTableViewCell else {
- return UITableViewCell()
- }
- cell.closeButton.addTarget(self, action: #selector(dismissMenu(sender:)), for: .touchUpInside)
- return cell
- } else if indexPath.row == 1 {
- guard let cell = tableView.dequeueReusableCell(withIdentifier: "MenuHomeTableViewCell", for: indexPath) as? MenuHomeTableViewCell else {
- return UITableViewCell()
- }
- return cell
- } else {
- guard let cell = tableView.dequeueReusableCell(withIdentifier: "MenuLogoutTableViewCell", for: indexPath) as? MenuLogoutTableViewCell else {
- return UITableViewCell()
- }
- return cell
- }
- }
- override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
- if indexPath.row == 0 {
- tableView.deselectRow(at: indexPath, animated: true)
- } else if indexPath.row == 1 {
- DispatchQueue.main.async {
- let learningModuleVC = self.storyboard?.instantiateViewController(withIdentifier: "DashboardViewController") as! DashboardViewController
-
- self.navigationController?.pushViewController(learningModuleVC, animated: false)
- }
- } else if indexPath.row == 2 {
- DispatchQueue.main.async {
- GIDSignIn.sharedInstance.signOut()
-
- let loginVC = self.storyboard?.instantiateViewController(withIdentifier: "LoginViewController") as! LoginViewController
-
- self.navigationController?.pushViewController(loginVC, animated: false)
- }
- }
- }
-
- override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
- if indexPath.row == 0 {
- return 137
- } else if indexPath.row == 1 {
- return 60
- } else {
- return 60
- }
- }
-
-
-
-
-
-
- }
|