title: Objects of same class have the same properties even though declared differently when pushing segue
body: <p>I've been stuck trying to fix an issue in my application that prevents me from getting my desired result.</p>
  
  <p>When pushing segue to the next view controller, I passed two objects of the same class to <code>var original:[Person] = []</code> and <code>var edited:[Person] = []</code></p>
  
  <pre><code>if (segue.identifier == "showSummary") {
  
      let vc = segue.destination as! SummaryViewController
      vc.original = myObject
      vc.edited = Bill.calculateBill(myObject, switchServiceCharge.isOn, switchGST.isOn)
      vc.gst = (switchServiceCharge.isOn, switchGST.isOn)
  }
  </code></pre>
  
  <p>Before <code>calculateBill</code>, the original value of a property inside is 11.</p>
  
  <p>The <code>calculateBill</code> is a class function in another class Bill:</p>
  
  <pre><code>class func calculateBill(_ bill: [Person],_ svcCharge: Bool,_ GST: Bool) -&gt; [Person] {
  
      var mutableBill = bill
  
      for i in 0 ..&lt; mutableBill.count {
  
          for j in 0 ..&lt; mutableBill[i].items.count {
  
              let tax = Bill.getGSTForIndividual(mutableBill[i].items[j].itemPrice, svcCharge, GST)
              mutableBill[i].items[j].itemPrice += tax
          }
      }
  
      return mutableBill
  }
  
  class func getGSTForIndividual(_ individualAmt: Decimal,_ svcCharge: Bool,_ GST: Bool) -&gt; Decimal {
  
      var taxCost : Decimal = 0.00
      let SERVICE_CHARGE = Bill.getServiceCharge() //0.10
      let GOODS_SERVICE_TAX = Bill.getGST() //0.07
  
      if (svcCharge &amp;&amp; GST) {
  
          taxCost = individualAmt * SERVICE_CHARGE
          taxCost = taxCost + ((individualAmt + taxCost) * GOODS_SERVICE_TAX)
      }
      else if (!svcCharge &amp;&amp; GST) {
  
          taxCost = individualAmt * GOODS_SERVICE_TAX
      }
      else if (svcCharge &amp;&amp; !GST) {
  
          taxCost = individualAmt * SERVICE_CHARGE
      }
      else {
  
          taxCost = 0.00
      }
  
      return taxCost
  }
  </code></pre>
  
  <p>When I did a <code>print()</code> to test whether the properties inside are different, they both yield the same results somehow...</p>
  
  <pre><code>print(original[0].items[0].itemPrice) //12.947000000000000123904, originally 11
  print(edited[0].items[0].itemPrice) //12.947000000000000123904
  </code></pre>
  
  <p>What exactly is going on and why do both the objects have the same properties even though I have declared them differently?</p>