StarRating

A star rating UI component, similar to the one you can see on the the App Store, when rating an app or on IMDB, when you rate a movie.

Overview

Usage

let starView = StarRating(frame: frame, totalStars: 5, selectedStars: 1)
starView.addTarget(self, action: #selector(starRatingValueChanged(_:)), for: .valueChanged)
view.addSubview(starView)

@objc func starRatingValueChanged(_ sender: StarRating) {
    print("Selected \(sender.selectedStars), out of \(sender.totalStars)")
}

License

StarRating is released under the MIT License.

Author

⭐️ Tarun Jain ⭐️

GitHub

View Github