BPKStarRating

public struct BPKStarRating : View

A view that displays a star rating based on a rating value.

  • An enum representing the rounding method to use.

    • down: Rounds down to the nearest half star.
    • up: Rounds up to the nearest half star.
    • nearest: Rounds to the nearest half star.
    See more

    Declaration

    Swift

    public enum Rounding
  • Initializes a new BPKStarRating instance.

    Declaration

    Swift

    public init(
        rating: Binding<Float>,
        maxRating: Int,
        size: BPKStarRatingSize = .small,
        rounding: Rounding = .down,
        onRatingChanged: ((Float) -> Void)? = nil
    )

    Parameters

    rating

    A binding to the current rating value.

    maxRating

    The maximum rating value allowed. Represents the number of stars to display.

    size

    The size of the star rating, defaults to .small.

    rounding

    The rounding method to use, defaults to .down.

    onRatingChanged

    A callback that is called when the user taps on a star.

  • Declaration

    Swift

    public var body: some View { get }