I want to do this:
public func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
struct Cell {
static let height: CGFloat = {
var cell:RentalViewCell = tableView.dequeueReusableCellWithIdentifier("RentalViewCell") as RentalViewCell
return cell.bounds.size.height
}()
}
return Cell.height
}
.. but the swift compiler throws a wobbly, and gives me a segmentation error in creating the SIL because of the tableView variable inside the block.
I know there are other ways I can write this, but can someone explain why it doesn't work this way and why I can't access tableView variable. I've tried using a capture list in the block to no avail.
Thanks