       buttonFrame.origin.x = CGFloat(index * (buttonSize + 5))
       button.frame = buttonFrame
     }
+
+    updateButtonSelectionStates()
   }
 
   override func intrinsicContentSize() -> CGSize {


  // MARK: Button Action
  func ratingButtonTapped(button: UIButton) {
    print("Button pressed!")
  }
}

class RatingControl: UIView {

  // MARK: Properties
  var rating = 0 {
    didSet {
      setNeedsLayout()
    }
  }

  var ratingButtons = [UIButton]()
  var spacing       = 5
  var stars         = 5
