Latest 0.1.0
Homepage https://github.com/EngrAhsanAli/AARatingBar
License MIT
Platforms ios 8.0
Authors

Table of Contents

Swift 3.0 Carthage compatible CocoaPods License MIT Build Status
License MIT [CocoaPods]()

Description

AARatingBar is a simple, lightweight & easy-to-use rating bar designed to get and set ratings in iOS, written in Swift. It is a customised storyboard based UIView class that allows to customise in the UIStoryboard without writing code.

Demonstration

AARatingBar

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

Requirements

  • iOS 8.0+
  • Xcode 8.0+
  • Swift 3+

Installation

AARatingBar can be installed using CocoaPods, Carthage, or manually.

CocoaPods

AARatingBar is available through CocoaPods. To install CocoaPods, run:

$ gem install cocoapods

Then create a Podfile with the following contents:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

target '<Your Target Name>' do
pod 'AARatingBar'
end

Finally, run the following command to install it:

$ pod install

Carthage

To install Carthage, run (using Homebrew):

$ brew update
$ brew install carthage

Then add the following line to your Cartfile:

github "EngrAhsanAli/AARatingBar" 

Then import the library in all files where you use it:

import AARatingBar

Manual Installation

If you prefer not to use either of the above mentioned dependency managers, you can integrate AARatingBar into your project manually by adding the files contained in the Classes folder to your project.

Getting Started


Create object of rating bar

Drag UIView object from the Object Library into your UIViewController in storyboard.

AARatingBar

Set view object as rating bar

Set the view’s class to AARatingBar in the Identity Inspector.
Make sure the module property is also set to AARatingBar.

AARatingBar

Customise the rating bar

You can customise the rating bar appearance in the Attributes Inspector.

Note: If storyboard does not show the stars click Refresh All Views from the Editor menu.

AARatingBar

Get rating through callback

You can get rating change though ratingDidChange closure.

ratingBar.ratingDidChange = { ratingValue in
// get current selected rating
}

You can check if rating is empty or not using simple property ratingBar.isEmpty.

Set optional values

You can use following variants:

Rating Options Types Description
isEnabled Bool Rating set enabled
canAnimate Bool Rating filling with animation
isEmpty Bool Selected rating is empty
isAbsValue Bool Precise rating or absolute
filledIcon String Filled star icon
unFilledIcon String Empty star icon
value CGFloat Current rating value
color UIColor Rating stars color
animationInterval TimeInterval Rating change animation

Contributions & License

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

Pull requests are welcome! The best contributions will consist of substitutions or configurations for classes/methods known to block the main thread during a typical app lifecycle.

I would love to know if you are using AARatingBar in your app, send an email to Engr. Ahsan Ali

Latest podspec

{
    "name": "AARatingBar",
    "version": "0.1.0",
    "summary": "AARatingBar is a simple, lightweight & easy-to-use rating bar designed to get and set ratings in iOS, written in Swift.",
    "description": "AARatingBar is a customised storyboard based `UIView` class that allows to get and set ratings easily. It is allows to customise in the Storyboard without writing code.",
    "homepage": "https://github.com/EngrAhsanAli/AARatingBar",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Engr. Ahsan Ali": "[email protected]"
    },
    "source": {
        "git": "https://github.com/EngrAhsanAli/AARatingBar.git",
        "tag": "0.1.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "pod_target_xcconfig": {
        "SWIFT_VERSION": "3.0"
    },
    "source_files": "AARatingBar/Classes/**/*",
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This