title: Traverse nsdictionary in swift
body: <p>I am new to swift.
  I have my dictionary as </p>
  
  <pre><code>monthData = 
  {
      "2018-08-10" = {
          accuracy = 71;
          attempted = 7;
          correct = 5;
          reward = Bronze;
      };
      "2018-08-12" = {
          accuracy = 13;
          attempted = 15;
          correct = 2;
          reward = "";
      };
      "2018-08-13" = {
          accuracy = 33;
          attempted = 15;
          correct = 5;
          reward = "";
      };
      "2018-08-14" = {
          accuracy = 100;
          attempted = 15;
          correct = 15;
          reward = Gold;
      };
      "2018-08-16" = {
          accuracy = 73;
          attempted = 15;
          correct = 11;
          reward = Silver;
      };
      "2018-08-21" = {
          accuracy = 26;
          attempted = 15;
          correct = 4;
          reward = "";
      };
      "2018-08-23" = {
          accuracy = 46;
          attempted = 15;
          correct = 7;
          reward = "";
      };
  }
  </code></pre>
  
  <p>I want to get all the dates for which <code>reward</code> is <code>Gold</code></p>
  
  <p>Can anyone please help me do that?</p>
  
  <p>What I have tried 'till now is:</p>
  
  <pre><code>for (key,value) in monthData{
     let temp = monthData.value(forKey: key as! String) as! NSDictionary
     for (key1,value1) in temp{
       if((value1 as! String) == "Gold"){
         print("keyFINAL \(key)")
       }
  }
  </code></pre>
  
  <p>but it outputs the error <code>Could not cast value of type '__NSCFNumber'  to 'NSString'</code></p>