Created
September 9, 2017 18:43
-
-
Save glennposadas/bd0561500f27409f6610e9a01c502b30 to your computer and use it in GitHub Desktop.
SVProgressHUD Extension
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// SVProgressHUD+FindWork.swift | |
// FindWork | |
// | |
// Created by Glenn Posadas on 1/20/17. | |
// Copyright © 2017 ThirtyOneDigital. All rights reserved. | |
// | |
import SVProgressHUD | |
import UIKit | |
extension SVProgressHUD { | |
/** Sets timeout for the HUD | |
*/ | |
open class func show(_ status: String, maxTime: TimeInterval) { | |
SVProgressHUD.show(withStatus: status) | |
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + maxTime) { | |
SVProgressHUD.dismiss() | |
} | |
} | |
open class func show(maxTime: TimeInterval) { | |
SVProgressHUD.show(withStatus: "Please wait...") | |
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + maxTime) { | |
SVProgressHUD.dismiss() | |
} | |
} | |
open class func showSuccess(completion: (() -> Void)?) { | |
SVProgressHUD.showSuccess(withStatus: "Success!") | |
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 1.0) { | |
completion?() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment