Latest 0.1.1
Homepage https://github.com/TXF/SKSpinner
License MIT
Platforms ios 5.0, requires ARC
Frameworks QuartzCore
Authors

SKSpinner CI Status Version Platform

SKSpinner is an iOS control that displays a loader while tasks is being processed.

SKSpinner

Requirements

SKSpinner works on any iOS version and is compatible with ARC projects. It depends on the following Apple frameworks, which should already be included with most Xcode templates:

  • Foundation.framework
  • UIKit.framework
  • QuartzCore.framework

Installation

Cocoapods

CocoaPods is the recommended way to add SKSpinner to your project.

  1. Add a pod entry for SKSpinner to your Podfile pod 'SKSpinner', '~> 0.1.1'
  2. Install the pod(s) by running pod install.
  3. Include SKSpinner wherever you need it with #import "SKSpinner.h".

Source files

Alternatively you can directly add the SKSpinner.h and SKSpinner.m source files to your project.

  1. Download the latest code version or add the repository as a git submodule to your git-tracked project.
  2. Open your project in Xcode, then drag and drop SKSpinner.h and SKSpinner.m onto your project (use the "Product Navigator view"). Make sure to select Copy items when asked if you extracted the code archive outside of your project.
  3. Include SKSpinner wherever you need it with #import "SKSpinner.h".

Usage

(see sample Xcode project in /Demo)

The main guideline you need to follow when dealing with SKSpinner while running long-running tasks is keeping the main thread work-free, so the UI can be updated promptly. The recommended way of using SKSpinner is therefore to set it up on the main thread and then spinning the task, that you want to perform, off onto a new thread.

[SKSpinner showTo:self.view animated:YES];
dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
    // Do something...
dispatch_async(dispatch_get_main_queue(), ^{
    [SKSpinner hideAnimated:NO];
});
});

If you need to configure the spinner you can do this by using the SKSpinner reference that initWithView: returns.

SKSpinner *spinner = [[SKSpinner alloc] initWithView:self.view];
spinner.minShowTime = 5.f;
spinner.color = [UIColor greenColor];
[spinner showAnimated:YES];
[self doSomethingInBackgroundWithProgressCallback:^(float progress) {
   // Do something...
} completionCallback:^{
    [spinner hideAnimated:YES];
}];

API documentation is provided in the header file (SKSpinner.h).

License

This code is distributed under the terms and conditions of the MIT license.

Latest podspec

{
    "name": "SKSpinner",
    "version": "0.1.1",
    "summary": "An iOS Skype-alike activity indicator view.",
    "description": "                       SKSpinner is an iOS control that displays a loader while tasks is being processed.n",
    "homepage": "https://github.com/TXF/SKSpinner",
    "license": "MIT",
    "authors": {
        "David": "[email protected]"
    },
    "source": {
        "git": "https://github.com/TXF/SKSpinner.git",
        "tag": "0.1.1"
    },
    "platforms": {
        "ios": "5.0"
    },
    "requires_arc": true,
    "frameworks": "QuartzCore",
    "source_files": "Pod/**/*"
}

Pin It on Pinterest

Share This