Closed kalaichelvan closed 4 years ago
Alright.
Managed to get it done with the help of
DispatchQueue.global(qos: .background).async {
// Background Thread
DispatchQueue.main.async {
// Run UI Updates or call completion block
}
}
Hi,
This is awesome library.
I am getting UIImage of selected assets and then save them locally in documents folder. As some of the assets are from cloud, it takes a while to import all the images. Is there a way to display the Hud view or activity indicator while importing the assets from library?
I attempted following but nothing helps:
self.window?.rootViewController?.showHud("Importing...")
UIApplication.shared.windows.last?.showLoading(animated: true, color: .systemBlue, dimColor: .systemGray, alpha: 1.0, verticalRatio: 10, isBlock: true)
if let topVC = UIApplication.getTopViewController() { topVC.showHud("Importing...") }
//getTopViewController
class func getTopViewController(base: UIViewController? = UIApplication.shared.keyWindow?.rootViewController) -> UIViewController? {
func showHud(_ message: String) { let hud = MBProgressHUD.showAdded(to: self.view, animated: true) let nvaview = NVActivityIndicatorView(frame: CGRect(x: 0, y: 0, width: 50, height: 50), type: .lineScale , color: .systemBlue, padding: nil) hud.mode = .customView hud.customView = nvaview hud.bezelView.color = UIColor.white hud.bezelView.style = .solidColor nvaview.startAnimating() hud.label.textColor = UIColor.systemBlue hud.label.text = message view.isUserInteractionEnabled = false hud.isUserInteractionEnabled = false }