File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
WooCommerce/Classes/ViewRelated/ReusableViews Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -16,11 +16,12 @@ class RatingView: UIView {
1616 return _rating
1717 }
1818 set ( newRating) {
19- if newRating >= Defaults . maxStars {
20- _rating = Defaults . maxStars
21- } else {
22- _rating = newRating
19+ guard ( newRating >= Defaults . minRating) else {
20+ _rating = Defaults . minRating
21+ return
2322 }
23+
24+ _rating = min ( newRating, Defaults . maxStars)
2425 }
2526 }
2627
@@ -42,7 +43,7 @@ class RatingView: UIView {
4243
4344 // MARK: Private Properties
4445
45- private var _rating : CGFloat = 0.0 {
46+ private var _rating : CGFloat = Defaults . minRating {
4647 didSet {
4748 updateImageViews ( )
4849 }
@@ -181,7 +182,8 @@ private class StarView: UIView {
181182// MARK: - Constants!
182183//
183184fileprivate enum Defaults {
184- static let padding = CGFloat ( 0.0 )
185+ static let minRating = CGFloat ( 0.0 )
185186 static let maxStars = CGFloat ( 5.0 )
187+ static let padding = CGFloat ( 0.0 )
186188 static let height = CGFloat ( 10.0 )
187189}
You can’t perform that action at this time.
0 commit comments