Latest 1.0.9
License MIT
Platforms ios 11.4, requires ARC

Swifty Ratings View

Swift 4.2
CocoaPods Compatible

A simpler ratings view. No fuss. Features swipe gesture.


  • iOS 11.4+
  • Swift 4.0+


CocoaPods is a dependency manager for Cocoa projects. Simply install the pod by adding the following line to your pod file

pod 'SwiftyRatingsView'

Altenatively you can drag the swift file(s) and XIBs manually into your project.


  • Add the import statment when you installed via cocoa pods.
import SwiftyRatingsView 
  • Add to view

Create a lazy property to instantiate the ratingsView. Call the configure method to setup the ratings view and add the callback handler to listen for ratings changes.

private lazy var ratingsView: RatingsView = {
let configuration = RatingsView.Configuration(
    image: UIImage(named: "star")!,
    numberOfItems: 5,
    startRating: 2,
    selectedColor: .orange,
    deselectedColor: .gray
$0.configure(with: configuration)
$0.handler = { [weak self] rating in
// Do your thing
return $0

Now there is 2 ways to add the ratings view to your actual view, stackviews or code.

Way 1, Stack views (preferred)

Add a stack view to your desired view via storyboards/xibs, give it a width and height constraints of. Than create an outlet to your UIView class that will show the ratings view. Finall use didSet to add the ratingsView.

@IBOutlet weak var ratingsStackView: UIStackView! {
    didSet {

Way 2, code

ratingsView.translatesAutoresizingMaskIntoConstraints = false
ratingsView.widthAnchor.constraint(equalToConstant: 160).isActive = true
ratingsView.heightAnchor.constraint(equalToConstant: 42).isActive = true
ratingsView.centerXAnchor.constraint(equalTo: view.safeAreaLayoutGuide.centerXAnchor).isActive = true
ratingsView.centerYAnchor.constraint(equalTo: view.safeAreaLayoutGuide.centerYAnchor).isActive = true

Latest podspec

    "name": "SwiftyRatingsView",
    "version": "1.0.9",
    "license": "MIT",
    "summary": "A simple ratings view.",
    "homepage": "",
    "social_media_url": "",
    "authors": {
        "Dominik": "[email protected]"
    "requires_arc": true,
    "platforms": {
        "ios": "11.4"
    "source": {
        "git": "",
        "tag": "1.0.9"
    "source_files": "SwiftyRatingsView/**/*.{swift}",
    "resource_bundles": {
        "SwiftyRatingsView": [

Pin It on Pinterest

Share This