#AARatingBar
##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
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+
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" "master"
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.
##Create object of rating bar
Drag UIView
object from the Object Library into your UIViewController
in storyboard.
##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
.
##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.
##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