Rating

The rating component is used to represent a score as an exact number.

Backpack/Rating

Cocoapods class reference view on Github

Default

Day Night

Usage

The BPKRating component supports two different sizes, as defined by the BPKRatingSize enum. It also includes two rating scales, defined in BPKRatingScale. An optional subtitle is available, which will be hidden if it is set to nil. The visibility of the rating scale (either /5 or /10) is controlled by the showScale property. If a titleView is provided, the title string will be ignored.

BPKRating


                                                
                                                import Backpack
                                                let ratingWithTitle = BPKRating(
                                                    accessibilityLabel: "",
                                                    title: "Excellent",
                                                    value: 4.5,
                                                )
                                                
                                                let starRating = BPKStarRating()
                                                starRating.rating = 4.5
                                                let ratingWithCustomView = BPKRating(
                                                    accessibilityLabel: "",
                                                    value: 4.5,
                                                    titleView: starRating
                                                )
                                                
                                                let ratingWithAllPossibleArguments = BPKRating(
                                                    accessibilityLabel: "",
                                                    title: "Excellent",
                                                    value: 4.5,
                                                    ratingScale: .zeroToTen,
                                                    size: .large,
                                                    subtitle: "1,532 reviews",
                                                    showScale: false,
                                                )