title: What is the purpose of .enumerated() and .map() in this code?
body: <p>I'm working a tutorial from <a href="https://www.raywenderlich.com/921-cocoa-bindings-on-macos" rel="nofollow noreferrer">https://www.raywenderlich.com/921-cocoa-bindings-on-macos</a>. I'm wondering what the .enumerated() and .map() functions are operating on in this section:</p>
  
  <p>@IBAction func searchClicked(_ sender: Any) {</p>
  
  <pre><code>  guard let resultsNumber = Int(numberResultsComboBox.stringValue)
      else {
        return
    }
    iTunesRequestManager.getSearchResults(searchTextField.stringValue, results: resultsNumber, langString: "en_us") { (results, error) in
      let itunesResults = results.map {
        return Result(dictionary: $0)
      }
  
        .enumerated()
        .map({ (index, element) -&gt; Result in
          element.rank = index + 1
          return element
        })
  
      DispatchQueue.main.async {
        self.searchResultsController.content = itunesResults
        print(self.searchResultsController.content!)
      }
    }
  
  }
  </code></pre>
  
  <p>I can usually figure out most things eventually in Swift but I'm stumped here and the explanatory text isn't clear to me either. I hope someone can help me understand this part of the tutorial. Thanks!</p>