This is a web app that automatically sets the network activity indicator for any performed request.
The swift show network activity indicator is a simple function that automatically sets the network activity indicator for any performed request.
BIG BROTHER IS ON THE LOOKOUT FOR YOU.
BigBrother is a Swift library for iOS that listens for and sets the network activity indicator when a request is made.
Because of the way NSURLProtocol works, this is mainly a proof of concept with many restrictions. Here are a few examples:
It was inspired by Mattt Thompson’s remark.
It was also based on AFNetworking’s AFNetworkActivityIndicatorManager and this guide for building an NSURLProtocol.
Usage
Adding
NSURLConnection and NSURLSession.sharedSession have been updated ()
BigBrother.addToSharedSession()
Adding to an NSURLSessionConfiguration that has been customized
BigBrother.addToSessionConfiguration = NSURLSessionConfiguration.defaultSessionConfiguration() var configuration = NSURLSessionConfiguration.defaultSessionConfiguration() (configuration) NSURLSession = let session (configuration: configuration)
Removing
NSURLConnection and NSURLSession.sharedSession are being deprecated ()
BigBrother.removeFromSharedSession()
Getting rid of a habit NSURLSessionConfiguration
NSURLSessionConfiguration.defaultSessionConfiguration var configuration = NSURLSessionConfiguration.defaultSessionConfiguration var configuration = NSURLSession () BigBrother.removeFromSessionConfiguration(configuration) NSURLSession = newSession (configuration: configuration)
REMINDER
Before utilizing your NSURLSessionConfiguration object to initialize a session object, make sure it’s configured correctly. Session objects duplicate the configuration parameters you give and use them to configure the session. The session object ignores any modifications you make to the NSURLSessionConfiguration object after it’s been setup. You must update the session configuration object and use it to build a new NSURLSession object if you need to change your transfer rules.
advanced application
BigBrother. The network activity indicator is managed by the URLProtocol subclass, which is public if you wish to add it to an NSURLSessionConfiguration or the default NSURLProtocol (used by NSURLConnection and NSURLSession.sharedSession()).
BigBrother.Manager is also open to the public, allowing you to directly control the network activity indicator:
BigBrother.Manager.shared Do something with Instance.incrementActivityCount()… BigBrother.Manager.sharedInstance.decrementActivityCount()
Installation
BigBrother may be found on CocoaPods. Simply add the following line to your Podfile to install it:
Then, with CocoaPods 0.36 or newer, run pod install.
Unit tests are tests that are performed on individual units.
XCTest is used for unit testing, and the tests are stored in the BigBrotherTests folder.
Collaborating
- Create an issue if you find a problem.
- Create an issue if you have a feature request.
- Submit a pull request if you wish to help. They’re always welcome!
Contact
Fabri, Marcelo
License
BigBrother is free to use and distribute under the MIT license. For additional information, see the LICENSE file.
GitHub
https://github.com/marcelofabri/BigBrother
The alamofire loading indicator is a library that automatically sets the network activity indicator for any performed request.
Related Tags
- activity indicator swift github
- alamofirenetworkactivitylogger
- custom loading indicator swift
- networkactivityindicatorvisible
- ios network activity indicator