title: Sorting two arrays by the order of one of the arrays [Swift 3.0 - Xcode 8]
body: <pre><code>var ArrayToShowInTable = [String]()
  </code></pre>
  
  <p>I have two arrays: </p>
  
  <pre><code>let list = ["Carrot", "Apple", "Toothbrush", "Pear", "Oranges"]
  let price = [3.50, 2.50, 1.50, 3.25, 4.25]
  </code></pre>
  
  <p>I want to order both these arrays by price (smallest to biggest),
  So I get something like:</p>
  
  <pre><code>list = ["Toothbrush", "Apple", "Pear", "Carrot", "Oranges"]
  price = [1.50, 2.50, 3.25, 3.50, 4.25]
  </code></pre>
  
  <p>So I can them join them </p>
  
  <pre><code>for i in 0...list.count-1{
  let join = list[i] += "\(price[i])"
  ArrayToShowInTable.append(join)
  }
  </code></pre>
  
  <p>And then present it in a TableView</p>
  
  <pre><code>func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
      return (ArrayToShowInTable.count)
  }
  
  
  func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
      let cell = UITableViewCell(style: UITableViewCellStyle.default, reuseIdentifier: "TableCell")
          cell.textLabel?.text = ArrayToShowInTable[indexPath.row] as? String
      return (cell)
  </code></pre>
  
  <p>Is there a way of doing this? 
  maybe use a struct and print to table?</p>
  
  <p>Please help??</p>