🔨🔨🔨 This is work in progress 🔨🔨🔨
This is a UI control for iOS for showing a 5-star rating or taking the rating input from the user. Cosmos is a subclass of a UIView.
- Shows star rating with an optional text label.
- Can be used as a rating input control.
- Cosmos view can be customized in the Storyboard without writing code.
- Includes different star filling modes: full, half-filled and precise.
We are a way for the cosmos to know itself.
Carl Sagan, Cosmos.
Picture of binary star system of Sirius A and Sirius B by NASA, ESA and G. Bacon (STScI). Source: spacetelescope.org.
There are three ways you can add Cosmos to your Xcode project.
Add source (iOS 7+)
Simply add CosmosDistrib.swift file into your Xcode project.
Setup with Carthage (iOS 8+)
Alternatively, add github "exchangegroup/Cosmos" ~> 1.0
to your Cartfile and run carthage update
.
Setup with CocoaPods (iOS 8+)
If you are using CocoaPods add this text to your Podfile and run pod install
.
use_frameworks!
pod 'Cosmos', '~> 1.0'
- Add
View
control into your storyboard. Set its class toTegStarRatingView
. - Add an outlet for this view in your view controller.
- Use
show
method to display rating:
ratingView.show(rating: 4, text: "(132)")
Customization can be made by changing settings
properties. For example:
ratingView.settings.starColorFilled = UIColor.blackColor()
ratingView.settings.starFillMode = TegStarFillMode.Precise
This project includes a demo iOS app.
Here are some other star rating controls for iOS:
- danwilliams64/DJWStarRatingView
- dlinsin/DLStarRating
- dyang/DYRateView
- erndev/EDStarRating
- hugocampossousa/HCSStarRatingView
- strekfus/FloatRatingView
- yanguango/ASStarRatingView
Star is released under the MIT License.