Latest 4.0.1
Homepage https://github.com/Sorix/RatingControl
License MIT
Platforms ios 10.0, requires ARC
Authors ,

A simple @IBDesignable rating control for iOS written in Swift. Supports whole, half or floating point values.

iOS Demo

Installation

Framework is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'RatingControl', '~> 4.0.1'

Framework is available through Carthage. To install
it, simply add the following line to your Cartfile:

github "Sorix/RatingControl" ~> 4.0.1

Usage

You can add rating view through Interface Builder, just drag new View object to a view and set class and module to RatingControl.

RatingControl is a subclass of UIControl.

You can configure almost everything in a storyboard.

Storyboard configuration of control

In a code you can additionally configure:

/// Float rating view type
var type: FloatRatingViewType = .wholeRatings

/// If control is not enabled, it can't be changed with user interaction
var isEnabled: Bool = true

To respond on events you may use storyboard‘s @IBAction connection. Also you can do it in the code:

override func viewDidLoad() {
  super.viewDidLoad()

  floatRatingView.addTarget(self, action: #selector(ratingChanged(_:)), for: .valueChanged)
}

func ratingChanged(_ sender: RatingControl) {
  print("New rating: (sender.rating)")
}

Tint color

You can apply custom color to images, to do that:

  1. Go to your assets and select empty and full images.
  2. At attribute inspector (on the right side) choose:

    Render as: Template Image

  3. Set desired tint color at RatingControl or use default tint color.

Author

Latest podspec

{
    "name": "RatingControl",
    "version": "4.0.1",
    "summary": "Whole, half or floating point ratings control written in Swift.",
    "homepage": "https://github.com/Sorix/RatingControl",
    "license": "MIT",
    "authors": {
        "Sorix": "[email protected]",
        "Glen Yi": "[email protected]"
    },
    "source": {
        "git": "https://github.com/Sorix/RatingControl.git",
        "tag": "4.0.1"
    },
    "source_files": "Source/**/*.swift",
    "platforms": {
        "ios": "10.0"
    },
    "requires_arc": true,
    "swift_version": "4.2"
}

Pin It on Pinterest

Share This