Swiftpack.co -  Package - franklynw/StarRatingView
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
franklynw/StarRatingView
A SwiftUI Rating view
.package(url: "https://github.com/franklynw/StarRatingView.git", from: "1.0.0")

StarRatingView

A simple SwiftUI rating view, with customisable colours.

Example 1

Installation

Swift Package Manager

In Xcode:

Example

NB: All examples require import StarRatingView at the top of the source file

StarRatingView(rating: rating)
    .outline(.purple)
    .padding()

Set a precise width

You can specify a width for the stars view in the init -

StarRatingView(rating: rating, width: geometry.size.width * 0.5)

If the width parameter is omitted, it will fit into the available space.

Set the base colour

StarRatingView(rating: rating)
    .baseColor(.myLightBlueColor)

Set the hightlighted colour

StarRatingView(rating: rating)
    .highlightedColor(.myBrightPinkColor)

Draw an outline around the stars (the highlighted portions)

StarRatingView(rating: rating)
    .outline(.purple, weight: .semibold)

Licence

StarRatingView is available under the MIT licence.

GitHub

link
Stars: 0
Last commit: 2 weeks ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco