Skip to content

shadow-of-arman/UIRating

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UIRating

A customizable rating View written in Swift.

Supported Platforms Swift Version Pod Version Documentation Travis Build GitHub license

Features

  • Super easy and simple to implement.
  • Drag through to rate.
  • Allow half rating.
  • Customizable icons.
  • Customizable option to rate from.

Quick Start

UIRating is available for installation using the Cocoa dependency manager CocoaPods. Alternatively, you can simply copy the UIRating.swift file into your Xcode project.

# CocoaPods
pod "UIRating", "~> 1.0"

Usage

The sample project in the example folder provides an example of how to integrate UIRating, otherwise you can follow these steps.

Create an instance of UIRating:

 let ratingView = UIRating()

Give the desired constraints and set the delegate:

 self.ratingView.delegate = self

DONE!

Customization

 self.stackView.emptyIcon = UIImage(named: "example")    //sets the icon for empty rating.
 self.stackView.halfFullIcon = UIImage(named: "example") //sets the icon for half a rating.
 self.stackView.fullIcon = UIImage(named: "example")     //sets the icon for a full rating.

 self.stackView.numberOfOptions = 7 //sets the number of rating options.
 
 self.stackView.allowHalfSelections = true //enables selecting half a rating.

 self.stackView.spacing = 10 //sets the spacing between each rating icon.

Delegate

 extension ViewController: UIRatingDelegate {
    func currentRating(rating: Double) {
        print(rating)
    }
}

Documentation

You can find the docs here. Documentation is generated with jazzy and hosted on GitHub-Pages.

Community

Resources

License

UIRating is available under the MIT license, see the LICENSE file for more information.