title: Cannot use mutating member on immutable value: function call returns immutable value - not sure why value is immutable
body: <p>Relatively new to Swift development. Trying to modify a couple functions someone else wrote. The goal is to leave the original pathway on the first time calling this after user login (that part hasn't been setup yet) and on subsequent calls, use another pathway.</p>
  
  <p>So before writing the logic that will direct to first or non-first pass through, I am testing the non-first pass through logic.</p>
  
  <p>Here's allOfferCards():</p>
  
  <pre><code>func allOfferCards() -&gt; [OfferCard]{
  
      guard dataSource != nil else {
          return []
      }
  
      let numberOfCards = self.dataSource!.kolodaNumberOfCards(self)
  
      var offerCards = [OfferCard]()
  
      for i in 0..&lt;numberOfCards {
          let offerCard = viewForCard(at: i)
  
          if let offerCard = offerCard {
              offerCards.append(offerCard as! OfferCard)
          }
  
      }
  
      return offerCards
  }
  </code></pre>
  
  <p>And here is where I am trying to make the changes. The original logic reverses the return from allOfferCards(). I want to use a custom function called "shuffle" that will randomize the array.</p>
  
  <pre><code>func displayOfferCards() -&gt; Void {
      // What was here originally
      //let offerCards = allOfferCards().reversed()
      var offerCards = allOfferCards().shuffle()
  
      for (index, offerCard) in offerCards.enumerated() {
          let delay = Double(index) * 0.2
          offerCard.display(delay: delay)
      }
  }
  </code></pre>
  
  <p>Here's the shuffle function</p>
  
  <pre><code>extension Array
  {
      /** Randomizes the order of an array's elements. */
      mutating func shuffle()
      {
          for _ in 0..&lt;10
          {
              sort { (_,_) in arc4random() &lt; arc4random() }
          }
      }
  }
  </code></pre>
  
  <p>However when I try to run this I get the error in the title - can't use a mutating member on an immutable value. However I'm not sure why allOfferCards() is generating an immutable value - var offerCards is defined using a var keyword, not a let keyword - this should mean it is mutable correct?</p>
  
  <p>What am I doing wrong here?</p>