Repo created
This commit is contained in:
parent
4af19165ec
commit
68073add76
12458 changed files with 12350765 additions and 2 deletions
|
|
@ -0,0 +1,43 @@
|
|||
@objc(MWMSpinnerAlert)
|
||||
final class SpinnerAlert: MWMAlert {
|
||||
@IBOutlet private weak var progressView: UIView!
|
||||
@IBOutlet private weak var title: UILabel!
|
||||
@IBOutlet private weak var cancelHeight: NSLayoutConstraint!
|
||||
@IBOutlet private weak var cancelButton: UIButton!
|
||||
@IBOutlet private weak var divider: UIView!
|
||||
|
||||
private var cancel: MWMVoidBlock?
|
||||
|
||||
private lazy var progress: MWMCircularProgress = {
|
||||
var p = MWMCircularProgress.downloaderProgress(forParentView: progressView)
|
||||
return p
|
||||
}()
|
||||
|
||||
|
||||
@objc static func alert(title: String, cancel: MWMVoidBlock?) -> SpinnerAlert? {
|
||||
guard let alert = Bundle.main.loadNibNamed(className(), owner: nil, options: nil)?.first
|
||||
as? SpinnerAlert else {
|
||||
assertionFailure()
|
||||
return nil
|
||||
}
|
||||
|
||||
alert.title.text = title
|
||||
alert.progress.state = .spinner
|
||||
alert.progress.setCancelButtonHidden()
|
||||
|
||||
if let cancel = cancel {
|
||||
alert.cancel = cancel
|
||||
} else {
|
||||
alert.cancelHeight.constant = 0
|
||||
alert.cancelButton.isHidden = true
|
||||
alert.divider.isHidden = true
|
||||
alert.setNeedsLayout()
|
||||
}
|
||||
|
||||
return alert
|
||||
}
|
||||
|
||||
@IBAction private func tap() {
|
||||
close(cancel)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue