In a Swift 3 project I'm working on, I have a simple view controller with a MBProgressHUD
. I can get the hud to show, and even though I set the mode property and the label's text, all I get is a spinning UIActivityIndicator
. Does anybody know how to fix this?
// Property declaration
var transferHUD = MBProgressHUD()
// Configured in viewDidLoad()
transferHUD = MBProgressHUD.init(view: self.view)
transferHUD.mode = MBProgressHUDMode.determinate
transferHUD.hide(animated: false)
// from the progressUpdated function
transferHUD.progress = Float(progress.fractionCompleted)
transferHUD.label.text = "Transferring..."
// I logged the mode and this is what it said
// print("HUD mode -- \(transferHUD.mode)")
// Output == transferHUD mode -- MBProgressHUDMode
// Here is where I show it again. I've tried a few different ways, but neither way changes the appearance
DispatchQueue.main.async {
// self.transferHUD.show(animated: true)
MBProgressHUD.showAdded(to: self.view, animated: true)
}
When you call showAdded:
, it will create a new instance of MBProgressHUD. You can either call the show method or change the code like:
let hud = MBProgressHUD.showAdded(to: self.view, animated: true)
hud.mode = MBProgressHUDMode.determinate
hud.label.text = "Transferring..."