title: Update CollectionView cells that are not selected?
body: <p>I have a CollectionView that allows a user to touch a cell and it will change the border color. However, I only want one cell to be selected at a time. How can I edit this code so that the cell at indexpath is updated with the border color and previously selected cell is reset?</p>
  
  <pre><code> override func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
  
          self.user["avatar"] = self.avatars[indexPath.row]
  
          do {
             try self.user.save()
          } catch {
              print(error)
          }
  
          let cell = collectionView.cellForItemAtIndexPath(indexPath) as! AvatarViewCell
          cell.layer.borderWidth = 5.0
          cell.layer.borderColor = UIColor.purpleColor().CGColor
  </code></pre>
  
  <p>Thanks!</p>
  
  <p>UPDATE</p>
  
  <pre><code>       let cell = collectionView.cellForItemAtIndexPath(indexPath) as! AvatarViewCell
          var previouslySelectedIndexPath: NSIndexPath?
          if previouslySelectedIndexPath != nil {
              let previousCell = collectionView.cellForItemAtIndexPath(previouslySelectedIndexPath!) as! AvatarViewCell
              previousCell.layer.borderWidth = 0
              previousCell.layer.borderColor = UIColor.whiteColor().CGColor
          }
  
          cell.layer.borderWidth = 5.0
          cell.layer.borderColor = UIColor.purpleColor().CGColor
  </code></pre>