None of us thought that tableview layouts coud fun or easy. After we sat down and solved the issues once and for all, we changed our minds. In this talk we are going tell you all how we did it.
set } } protocol Section { var items: [Item] { get set } var header: HeaderFooter? { get } var footer: HeaderFooter? { get } } protocol Item { var drawer: CellDrawer.Type { get } var height: Height? { get } }
set } } protocol Section { var items: [Item] { get set } var header: HeaderFooter? { get } var footer: HeaderFooter? { get } } protocol Item { var drawer: CellDrawer.Type { get } var height: Height? { get } } protocol HeaderFooter { var drawer: HeaderFooterDrawer.Type { get } var height: Height? { get } }
{ var estimated: CGFloat { switch self { case .static(let value): return value case .dynamic(let value): return value } } var height: CGFloat { switch self { case .static(let value): return value case .dynamic(_): return UITableViewAutomaticDimension } } }
to dequeue a cell with identifier UITableViewCell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard' *** First throw call stack: ( 0 CoreFoundation 0x0000000108666d4b __exceptionPreprocess + 171 1 libobjc.A.dylib 0x00000001058af21e objc_exception_throw + 48 2 CoreFoundation 0x000000010866ae42 +[NSException raise:format:arguments:] + 98 3 Foundation 0x000000010544471d -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195 4 UIKit 0x00000001065eb8f4 -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:] + 259