blob: 1aa6260a54a2891f318253ac789885d56ff95f1b (
plain) (
tree)
|
|
//
// 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)
}
}
|