title: How to access the system colors programmatically in Swift?
body: <p>I'm trying to programmatically set the background color of an UIButton to the color <code>UIColor.systemBlue</code>, which I assume should be accessible according to the docs of <a href="https://developer.apple.com/documentation/uikit/uicolor/standard_colors/" rel="nofollow noreferrer">UIColor</a> and the <a href="https://developer.apple.com/design/human-interface-guidelines/ios/visual-design/color/#system-colors" rel="nofollow noreferrer">color guidelines</a>. However, I can only access the regular colors such as <code>.blue</code> and <code>.red</code>. In the interface builder I can select <code>systemBlue</code> but not programmatically.</p>
  
  <p>I'm using Xcode 10.3 and building for iOS 12.4.</p>
  
  <p><strong>EDIT</strong>:
  I've seen the question <a href="https://stackoverflow.com/questions/47995595/ios-11-x-system-colors">iOS 11.x system colors</a>, but it doesn't make sense. In the color guidelines it's clearly stated that the system color values shouldn't be hard-coded, but to use the API instead. And in the UIColor docs the system colors seem to be accessible as public class vars of UIColor.</p>