title: Swift Darkmode Background Gradient
body: <p>I found this bit of code online to add a gradient to my project and it does add the gradient beautifully</p>
  
  <pre><code>let gradientLayer = CAGradientLayer()
      gradientLayer.frame = self.view.bounds
      gradientLayer.colors = [UIColor.systemBackground.cgColor, UIColor.systemGray2.cgColor]
      self.view.layer.insertSublayer(gradientLayer, at: 0)
  </code></pre>
  
  <p>However, the colors don't change when I change between dark and light mode. I'm not sure why this is happening since I am using dark mode compatible colors. If anyone knows how to fix that bug please let me know. </p>