 		sections[indexPath.section].tableView(tableView, accessoryButtonTappedForRowWith: indexPath)
 		trace(indexPath)
 	}
-	
-	// MARK: UIScrollViewDelegate
-	
+}
+
+extension TableViewSectionArray: UIScrollViewDelegate {
 	/// hide keyboard when the user starts scrolling
 	public func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
 		guard let responder = scrollView.form_firstResponder() else {

// MIT license. Copyright (c) 2016 SwiftyFORM. All rights reserved.
import UIKit

public class TableViewSectionArray: NSObject, UITableViewDataSource, UITableViewDelegate {
	public let sections: [TableViewSection]
	
	public init(sections: [TableViewSection]) {

		}
	}
	
	var numberOfVisibleItems: Int {
		var count = 0
		for section in sections {
			count += section.cells.visibleItems.count
		}
		return count
	}

	public override var debugDescription: String {
		var result = [String]()
		result.append("============ number of sections: \(sections.count)")
		for (sectionIndex, section) in sections.enumerated() {
			result.append("  --- section: \(sectionIndex), number of cells: \(section.cells.visibleItems.count)")
			for (rowIndex, item) in section.cells.visibleItems.enumerated() {
				let cellType = type(of: item.cell)
				let s = "    \(sectionIndex).\(rowIndex) \(cellType)"
				result.append(s)
			}
		}
		result.append("============")
		return result.joined(separator: "\n")
	}

	func trace(_ items: Any?..., function: String = #function) {
		//print("\(function) - \(items)")
	}
}

extension TableViewSectionArray: UITableViewDataSource {
	public func numberOfSections(in tableView: UITableView) -> Int {
		let returnValue = sections.count
		trace(returnValue)
