
Star Rating
Scrub your finger across the stars to rate with half-star precision: each star pops, tilts and fills with a gradient, and a perfect score fires a sparkle burst and a hopping wave.
- input
- gesture
- animation
snippet.swift245 lines
5 files • Scroll to see all →
/// A scrub-to-rate control. Drag your finger across the row (or tap a star)/// and each star pops, tilts and fills with a gradient as you pass it,/// with half-star precision. Reaching the top rating sends a sparkle burst/// out of the row while the stars hop in a wave.public struct StarRatingControl: View { @Binding var rating: Double var maxRating: Int var allowsHalfStars: Bool var starSize: CGFloat var spacing: CGFloat var colors: [Color] @State private var bursts = 0 @State private var isScrubbing = false public init( rating: Binding<Double>, maxRating: Int = 5, allowsHalfStars: Bool = true, starSize: CGFloat = 44,// ... (click "Show full code" to see more)Viewing: StarRating.swift•1 of 5