ATProgressOverlay

public class ATProgressOverlay: NSObject

The ATProgressOverlay creates an overlay that can be used to indicate any application activity and to disable user interaction with the application for some time.

  • The variable allows to get a singleton instance of the class.

    Usage Example

    ATProgressOverlay.sharedInstance
    

    Declaration

    Swift

    public static let sharedInstance :ATProgressOverlay = ATProgressOverlay()
  • The variable allows to have blur background for the progress overlay.

    Usage Example

    ATProgressOverlay.sharedInstance.shouldBlurBackground = true
    

    Declaration

    Swift

    public var shouldBlurBackground :Bool = false
  • The variable allows to set background color for the progress overlay.

    Usage Example

    ATProgressOverlay.sharedInstance.backgroundColor = UIColor(red: 135.0/255.0, green: 206.0/255.0, blue: 250.0/255.0, alpha: 0.5)
    

    Precondition

    shouldBlurBackground should be set as false.

    Declaration

    Swift

    public var backgroundColor :UIColor? = nil
  • The variable allows to set the visual style of the activity indicator on progress overlay.

    Usage Example

    ATProgressOverlay.sharedInstance.activityIndicatorViewStyle = UIActivityIndicatorViewStyle.whiteLarge
    

    Declaration

    Swift

    public var activityIndicatorViewStyle :UIActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.white
  • The variable allows to hide / show the activity indicator on progress overlay.

    Usage Example

    ATProgressOverlay.sharedInstance.isActivityIndicatorHidden = true
    

    Declaration

    Swift

    public var isActivityIndicatorHidden :Bool = false
  • The variable allows to set the message on progress overlay.

    Usage Example

    ATProgressOverlay.sharedInstance.message = "Loading your request, please wait until response is received from the server."
    

    Declaration

    Swift

    public var message :String? = nil
  • The variable allows to set the message color on progress overlay.

    Usage Example

    ATProgressOverlay.sharedInstance.messageColor = UIColor.orange
    

    Declaration

    Swift

    public var messageColor :UIColor? = nil
  • The function allows to show the progress overlay.

    Usage Example

    ATProgressOverlay.sharedInstance.show() // Does not show network activity indicator on status bar.
    
    ATProgressOverlay.sharedInstance.show(isNetworkActivity: true) // Shows network activity indicator on status bar.
    

    See also

    func hide(force :Bool)

    Declaration

    Swift

    public func show(isNetworkActivity pIsNetworkActivity :Bool = false)

    Parameters

    pIsNetworkActivity

    Parameter to show network activity indicator on status bar.

  • The function allows to hide the progress overlay.

    Note that if you call show method twice, then you have to call hide method twice to hide the overlay, otherwise call hide with force parameter as true. In short it goes like, 1) show - hide - show - hide 2) show - show - hide - hide 3) show - show - hide (force :true)

    Usage Example

    // Scenario 1
    ATProgressOverlay.sharedInstance.show()
    ATProgressOverlay.sharedInstance.hide()
    ATProgressOverlay.sharedInstance.show()
    ATProgressOverlay.sharedInstance.hide()
    
    // Scenario 2
    ATProgressOverlay.sharedInstance.show()
    ATProgressOverlay.sharedInstance.show()
    ATProgressOverlay.sharedInstance.hide()
    ATProgressOverlay.sharedInstance.hide()
    
    // Scenario 3
    ATProgressOverlay.sharedInstance.show()
    ATProgressOverlay.sharedInstance.show()
    ATProgressOverlay.sharedInstance.hide(force: true)
    
    

    See also

    func show(isNetworkActivity :Bool)

    Declaration

    Swift

    public func hide(force pForce :Bool = false)

    Parameters

    pForce

    Parameter to hide the progress overlay forcefully.