title: Why are my buttons not changing color when selected?
body: <p>I have several buttons on a single view controller which I want to change color when they are selected. My current code is as follows</p>
  <pre><code>@IBAction func academicButtonPressed(_ sender: Any) {
      if academicButton.backgroundColor == UIColor.systemBackground {
          academicButton.backgroundColor = UIColor(red: 20, green: 215, blue: 201, alpha: 1)
          academicButton.setTitleColor(UIColor.systemBackground, for: .selected)
      } else {
          academicButton.backgroundColor = UIColor.systemBackground
          academicButton.setTitleColor(UIColor(red: 20, green: 115, blue: 201, alpha: 1), for: .selected)
      }
  }
  </code></pre>
  <p>But it doesn't work. What am I doing wrong? (This is just on of the many buttons; they will all do the same thing when selected).</p>