diff options
author | Nicholas Tay <nick@windblume.net> | 2022-03-21 19:36:43 +1100 |
---|---|---|
committer | Nicholas Tay <nick@windblume.net> | 2022-03-21 19:36:43 +1100 |
commit | d776ba9c6ec94d6622e1f759c112fd2334b7fb8b (patch) | |
tree | f9ebfceaeb403a2a08cb0471efebe085be45745f /foray/ForayTableViewController.swift | |
parent | 54600245b35b2591b5ca19e39c80b8d9d0ae5f9e (diff) | |
download | forayios-d776ba9c6ec94d6622e1f759c112fd2334b7fb8b.tar.gz forayios-d776ba9c6ec94d6622e1f759c112fd2334b7fb8b.tar.bz2 forayios-d776ba9c6ec94d6622e1f759c112fd2334b7fb8b.zip |
Loading overlay to custom class + add to coordinator
Just an idea I had, since it was quite messy that a TableViewController
was handling all that. Instead now it should be reusable through the
ForayCoordinator itself, which means e.g. on details screen, we can show
the loading overlay.
Diffstat (limited to 'foray/ForayTableViewController.swift')
-rw-r--r-- | foray/ForayTableViewController.swift | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/foray/ForayTableViewController.swift b/foray/ForayTableViewController.swift index 827d4ea..2b7ba65 100644 --- a/foray/ForayTableViewController.swift +++ b/foray/ForayTableViewController.swift @@ -33,18 +33,9 @@ class ForayTableViewController: UITableViewController, ForayCoordinated { tableView.register(ForayNewTableViewCell.self, forCellReuseIdentifier: "ForayNewTableViewCell") // Not sure if this is the right way to go about this... - let alert = UIAlertController(title: nil, message: "Grabbing data...", preferredStyle: .alert) - let loadingIndicator = UIActivityIndicatorView(frame: CGRect(x: 10, y: 5, width: 50, height: 50)) - loadingIndicator.hidesWhenStopped = true - loadingIndicator.style = UIActivityIndicatorView.Style.medium - loadingIndicator.startAnimating(); - alert.view.addSubview(loadingIndicator) - present(alert, animated: true, completion: nil) - + coordinator?.showLoading() reloadApiData() - dismiss(animated: false, completion: nil) - self.refreshControl = UIRefreshControl() self.refreshControl?.addTarget(self, action: #selector(doRefresh), for: UIControl.Event.valueChanged) } @@ -71,6 +62,7 @@ class ForayTableViewController: UITableViewController, ForayCoordinated { self.tableView.reloadData() self.refreshControl?.endRefreshing() + self.coordinator?.hideLoading() }) } |