diff options
Diffstat (limited to 'foray')
-rw-r--r-- | foray/ForayTableViewController.swift | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/foray/ForayTableViewController.swift b/foray/ForayTableViewController.swift index fd4854e..67f0bc5 100644 --- a/foray/ForayTableViewController.swift +++ b/foray/ForayTableViewController.swift @@ -55,6 +55,15 @@ class ForayTableViewController: UITableViewController { override func viewDidLoad() { super.viewDidLoad() + // 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) + loadApiData(onComplete: { (apiItems) in self.items = apiItems @@ -69,6 +78,8 @@ class ForayTableViewController: UITableViewController { self.tableView.reloadData() }) + + dismiss(animated: false, completion: nil) } func loadApiData(onComplete: @escaping ([MyItem]) -> ()) { |