xcode - Parse stack to second view -


im creating rpn calculator in swift. need code view calculations when tape button pressed segue secondvc. when tape button pressed display calculations entered.the functionality in second view controller. im knew programming. have implemented prepareforsegue in first vc. not know how pass stack numberofrowsinsection

calculator engine

class calculatorengine :nsobject  {      var operandstack = array<double>()      func updatestackwithvalue(value: double)     {         self.operandstack.append(value)     }       func operate(operation: string) ->double     {          switch operation         {         case "×":             if operandstack.count >= 2         {         return self.operandstack.removelast() * self.operandstack.removelast() 

second view

class secondvcviewcontroller: uiviewcontroller, uitableviewdelegate, uitableviewdatasource {  var array = [""]  func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int {     return array.count }  func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) ->  uitableviewcell {      let cell = tableview.dequeuereusablecellwithidentifier("cell") uitableviewcell      cell.textlabel?.text = array[indexpath.row]      return cell 


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

python - pip wont install .WHL files -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -