title: Cannot subscript a value of type '[Int : UIColor]' with an index of type 'NSNumber'
body: <p>Good day. I was trying to follow this tutorial <a href="https://www.youtube.com/watch?v=3jJiqzbzutU" rel="nofollow"><code>https://www.youtube.com/watch?v=3jJiqzbzutU</code></a> and had this error message  Cannot subscript a value of type '[Int : UIColor]' with an index of type <code>NSNumber</code>. I did the same thing he did in the tutorial and this went wrong. Please help. The error comes from this line of code </p>
  
  <p><code>self.view.backgroundColor = self.colors[closestBeacon.major]</code>. </p>
  
  <p>Here is my code for reference. </p>
  
  <pre><code>class ViewController: UIViewController, CLLocationManagerDelegate {
  
  let locationManager = CLLocationManager()
  let region1 = CLBeaconRegion(proximityUUID: NSUUID(UUIDString: "myuuidString")!, identifier: "skybeacon1")
  
  let colors = [2: UIColor.redColor(), 1: UIColor.blueColor()]
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      locationManager.delegate = self
  
      if CLLocationManager.authorizationStatus() != CLAuthorizationStatus.AuthorizedWhenInUse {
          locationManager.requestWhenInUseAuthorization()
      }
      locationManager.startRangingBeaconsInRegion(region1)
  }
  
  func locationManager(manager: CLLocationManager, didRangeBeacons beacons: [CLBeacon], inRegion region: CLBeaconRegion) {
      let knownBeacons = beacons.filter{ $0 .proximity != CLProximity.Unknown }
      if knownBeacons.count &gt; 0 {
          let closestBeacon = knownBeacons[0] as CLBeacon
          self.view.backgroundColor = self.colors[closestBeacon.major]
      }
  }
  }
  </code></pre>