jdg / MBProgressHUD

MBProgressHUD + Customizations
http://www.bukovinski.com/
MIT License
16.01k stars 3.56k forks source link

Fix `+ (MBProgressHUD *)HUDForView:(UIView *)view` for Swift #543

Closed arror closed 6 years ago

arror commented 6 years ago

This method will be mapped to a convenience constructor in Swift.

if let hud = MBProgressHUD.init(for: self.base.view) {
    return hud
} else {
    let hud = MBProgressHUD()
    self.base.view.addSubview(hud)
    return hud
}
merkury commented 5 years ago

well HUDForView did something different: it searches through all subviews, if one is a MBProgressHUD . This is important i.e. if you want to know if a MBProgressHUD is already shown. So I am still missing this function in swift. See my comment in https://github.com/jdg/MBProgressHUD/issues/450 as well.