formViewController assumes XLFormViewController is in the responder chain
#720 opened on Feb 5, 2016
Description
The method formViewController in XLFormBaseCell.m tries to get the form VC associated with the cell by climbing up the responder chain until it hits any VC. This seems like a bad assumption and here's why:
It's a generally accepted practice to have a VC (A) own another VC (B) using the child view controller array and add B's view to A. In that case, B will no longer be in the responder chain (I actually didn't know this, go figure) and the assumption made above is then violated. I have a case like this because I'm using the view of an XLFormVIewController as a subview of a monolithic VC. This is breaking the formViewController method and wreaking all sorts of havoc.
My interim fix will be to overwrite that method with a category extension to do some special logic that handles my case. In general, though, maybe cells should just keep a weak reference to their XLFormViewController if they really need it? This feels like a more sound approach.