Rate is a simple and beautiful rating control written in SwiftUI, which supports touch gestures and can be customized with different colors and sizes.
- 支持自定义count。
- 支持自定义icon。
- 支持自定义color。
- 支持自定义size。
- 支持点击和滑动事件。
- 支持震动反馈
To use Rate, simply import it into your SwiftUI project and create an instance of the RateView
struct.
import Rate
struct ContentView: View {
@State private var rating = 0
var body: some View {
// default propotize count: Int = 6, size: FontSize = .regular ,icon:IconType = .heart,color:Color = .pink
Rate(rating: $rating)
}
}
}
Rate supports customization of colors, sizes, labels, and more. To customize a RateView, simply pass in the desired values as parameters when creating the instance.
Rate(rating: $rating, count: 5, size: .large, color: .pink)
Rate is available through Swift Package Manager. To install it, simply add Rate to your Package.swift
file and run swift package update
.
dependencies: [
.package(url: "https://github.com/golove/Rate.git", from: "1.0.0")
]
`