Created
December 14, 2018 10:57
-
-
Save arslanbilal/83d9b24790551971085cf683553a5cab to your computer and use it in GitHub Desktop.
NetworkActivity
This file contains hidden or 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
// | |
// JuxNetworkActivityIndicator.swift | |
// Bilal Arslan | |
// | |
// Created by BILAL ARSLAN on 14.12.2018. | |
// Copyright © 2018 BILAL ARSLAN. All rights reserved. | |
// | |
import UIKit | |
class JuxNetworkActivityIndicator { | |
private static var loadingCount = 0 | |
class func add() { | |
if loadingCount == 0 { | |
UIApplication.shared.isNetworkActivityIndicatorVisible = true | |
} | |
loadingCount += 1 | |
} | |
class func remove() { | |
if loadingCount > 0 { | |
loadingCount -= 1 | |
} | |
if loadingCount == 0 { | |
UIApplication.shared.isNetworkActivityIndicatorVisible = false | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment