-1

I want change this code

for (var i = tableView(self.tableView , numberOfRowsInSection: 0) - 1; i>0; i-=1 ) {
     tableViewHeight = height + tableView(self.tableView, heightForRowAtIndexPath: NSIndexPath(forRow: i, inSection: 0) )
}

to Swift. I got an error at for.

MWiesner
  • 8,868
  • 11
  • 36
  • 70
MAS. John
  • 582
  • 6
  • 22
  • 5
    Possible duplicate of [Decrement index in a loop after Swift C-style loops deprecated](http://stackoverflow.com/questions/35032182/decrement-index-in-a-loop-after-swift-c-style-loops-deprecated) – Nirav D Jan 04 '17 at 12:21

2 Answers2

0

You can try to use this model as reference and migrate your code:

for i in (0..<count).reversed() {
    print(i)
}
Lexorus
  • 199
  • 7
0

In SWIFT 3

    let count = tableView(self.tableView, numberOfRowsInSection: 0) as Int
    for i in (0 ..< count).reversed() {

        tableViewHeight = height + tableView(self.tableView, heightForRowAt: IndexPath(row: i, section: 0))
    }
Lineesh K Mohan
  • 1,702
  • 14
  • 18