Latest 1.0.2
Homepage https://github.com/dtrisciuoglio/FloatyActivityIndicatorController
License MIT
Platforms ios 8.0
Authors

Language
CocoaPods Compatible
License
Email

ActivityIndicatorController is an iOS class that displays an indicator while work is being done in a background thread.

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

ActivityIndicatorView

// Initialize the activity indicator view
let origin = CGPoint(x:40, y:40)
let size = CGSize(width:40, height:40)
let frame = CGRect(origin:origin, size:size)
let activityIndicatorView = ActivityIndicatorView(frame: frame)

// Set the line width of the activity indicator view
activityIndicatorView.lineWidth = 4

// Set the color of the activity indicator view
activityIndicatorView.tintColor = UIColor.red

// Add it as a subview
self.view.addSubview(activityIndicatorView)

// Start animation
activityIndicatorView.startAnimating()

// Stop animation
//activityIndicatorView.stopAnimating()

ActivityIndicatorController

// Create the URLSessionConfiguration and then create a session with that configuration.
let configuration = URLSessionConfiguration.default
let session = URLSession(configuration: configuration)

// Initialize the shared instance activity indicator controller.
let activityIndicator = ActivityIndicatorController.shared
// Set the color of the activity indicator view
activityIndicator.view.tintColor = UIColor.red

// Set the line width of the activity indicator view
activityIndicator.activityIndicatorView?.lineWidth = 4;

// Create the URLRequest using either an URL
if let url = URL.init(string: "https://httpbin.org/get") {

    let request = URLRequest(url: url)

    // Show the activity indicator
    activityIndicator.show()

    // Or set the color after call the show()
    //activityIndicator.activityIndicatorView?.tintColor = UIColor.red

    // Call the web service
    let dataTask = session.dataTask(with: request, completionHandler: {_,_,_ in

        // Hide the activity indicator
        activityIndicator.hide()
    })
    dataTask.resume()
}

Also support xib and storyboard

The lineWidth and tintColor properties can even be set after animating has been started, which you can observe in the included example project.

Requirements

  • iOS 8.0+
  • Xcode 8.2
  • Swift 3.0+

Installation

CocoaPods

You can use CocoaPods to install FloatyActivityIndicatorController by adding it to your Podfile:


   platform :ios, '8.0'
   use_frameworks!
   pod "FloatyActivityIndicatorController"

Author

Dario Trisciuoglio

License

FloatyActivityIndicatorController is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "FloatyActivityIndicatorController",
    "version": "1.0.2",
    "summary": "An iOS activity indicator view.",
    "description": "`ActivityIndicatorController` is an iOS class that displays an indicator while work is being done in a background thread.",
    "homepage": "https://github.com/dtrisciuoglio/FloatyActivityIndicatorController",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Dario Trisciuoglio": "[email protected]"
    },
    "source": {
        "git": "https://github.com/dtrisciuoglio/FloatyActivityIndicatorController.git",
        "tag": "1.0.2"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "Source/*.{swift}",
    "resource_bundles": {
        "FloatyActivityIndicatorController": "Assets/**/*.{xib,storyboard}"
    },
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This