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.
Declaration
Swift
public enum Rounding -
Initializes a new
BPKStarRatinginstance.Declaration
Swift
public init( rating: Binding<Float>, maxRating: Int, size: BPKStarRatingSize = .small, rounding: Rounding = .down, onRatingChanged: ((Float) -> Void)? = nil )Parameters
ratingA binding to the current rating value.
maxRatingThe maximum rating value allowed. Represents the number of stars to display.
sizeThe size of the star rating, defaults to
.small.roundingThe rounding method to use, defaults to
.down.onRatingChangedA callback that is called when the user taps on a star.
-
Declaration
Swift
public var body: some View { get }