ORIGINAL MAIL
We recently converted our app to Swift 2.0 and iOS9. One strange problem that I see is that calling tableView.dequeueReusableCellWithIdentifier () causes the application to hang in the simulator.
Code
func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { //hangs on the line below let headersection: HeaderSectionCell = tableView.dequeueReusableCellWithIdentifier("SectionHeader") as! HeaderSectionCell ... return headersection }
Header cell
class HeaderSectionCell: UITableViewCell { @IBOutlet var labelOne: UITextView! @IBOutlet var labelTwo: UITextView! @IBOutlet var textView: UITextView! }
CPU utilization for 100% binding

After pausing in Xcode, it shows me that it hangs over this Swift function.

Here are some of the routines in which iOS loops under the covers.


Finally, our Swift call for dequeueReusableCellWithIdentifier () 
This particular hanging instance is from the tableView(tableView: UITableView, viewForHeaderInSection section: Int) function tableView(tableView: UITableView, viewForHeaderInSection section: Int) , but we are also inside the call to tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) with the same problem.
I tried playing with the properties of the cells in the storyboard editor, but nothing is different from other views that work fine.
EDIT
There seems to be an endless loop between Foundation and libobjc.A.dylib, under this call to dequeReusableCellWithIdentifier (). I ended up importing the Foundation in front of any other structures and abstracting the abusive UITableViewCell in its own class (reused). The original call now works, but there is another one that is still looping under the Swift covers, which I work to understand.
Enabling a pause in an infinite loop puts me in the same place on the assembly stack:
Top stack trace after pause:
libobjc.A.dylib`objc_msgSend: 0x107f6a800 <+0>: testq %rdi, %rdi 0x107f6a803 <+3>: jle 0x107f6a850 ; <+80> 0x107f6a805 <+5>: movq (%rdi), %r11 0x107f6a808 <+8>: movq %rsi, %r10 0x107f6a80b <+11>: andl 0x18(%r11), %r10d 0x107f6a80f <+15>: shlq $0x4, %r10 0x107f6a813 <+19>: addq 0x10(%r11), %r10 0x107f6a817 <+23>: cmpq (%r10), %rsi 0x107f6a81a <+26>: jne 0x107f6a820 ; <+32> -> 0x107f6a81c <+28>: jmpq *0x8(%r10)
Top stack trace after another pause:
Foundation`-[NSLocalizableString length]: 0x1071c5cbc <+0>: pushq %rbp 0x1071c5cbd <+1>: movq %rsp, %rbp -> 0x1071c5cc0 <+4>: movq 0x80461(%rip), %rax ; NSLocalizableString._developmentLanguageString 0x1071c5cc7 <+11>: movq (%rdi,%rax), %rdi 0x1071c5ccb <+15>: movq 0x7436e(%rip), %rsi ; "length" 0x1071c5cd2 <+22>: popq %rbp 0x1071c5cd3 <+23>: jmpq *0x8ea77(%rip) ; (void *)0x0000000107f6a800: objc_msgSend
It just loops between these two downstream procedures, consuming 100% of the CPU simulator.