From 1b292bc251b3dbef532dacad9705bd197ac4227b Mon Sep 17 00:00:00 2001 From: Nicholas Tay Date: Thu, 24 Mar 2022 16:32:23 +1100 Subject: Reorganise into folder groups In preparation for presenters to come in largely, lots of files starting to go everywhere... --- foray/Scenes/ForayLoadingOverlay.swift | 37 ++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 foray/Scenes/ForayLoadingOverlay.swift (limited to 'foray/Scenes/ForayLoadingOverlay.swift') diff --git a/foray/Scenes/ForayLoadingOverlay.swift b/foray/Scenes/ForayLoadingOverlay.swift new file mode 100644 index 0000000..1aa6260 --- /dev/null +++ b/foray/Scenes/ForayLoadingOverlay.swift @@ -0,0 +1,37 @@ +// +// ForayLoadingOverlay.swift +// foray +// +// Created by Nicholas Tay on 21/3/2022. +// + +import UIKit + +class ForayLoadingOverlay { + + var viewController: UIViewController + + let loadingIndicator: UIActivityIndicatorView = { + let aiv = UIActivityIndicatorView(frame: CGRect(x: 10, y: 5, width: 50, height: 50)) + aiv.hidesWhenStopped = true + aiv.style = UIActivityIndicatorView.Style.medium + aiv.startAnimating() + return aiv + }() + + let alert: UIAlertController = UIAlertController(title: nil, message: "Grabbing data...", preferredStyle: .alert) + + init(viewController: UIViewController) { + self.viewController = viewController + alert.view.addSubview(self.loadingIndicator) + } + + func show() { + viewController.present(alert, animated: true) + } + + func hide() { + viewController.dismiss(animated: false) + } + +} -- cgit