NSOutlineView for UIKit (recreation of popular control from AppKit)
The behavior is implemented with the maximum functionality of the classic component and is slightly expanded
- iOS 13.0+ (macCatalyst)
- Swift 5
Just add the Source
folder to your project.
use CocoaPods with Podfile:
pod 'CatalystOutlineView', '~> 0.1'
Just drop UITableView and set its class to be one of CatalystOutlineView.
private var outline = CatalystOutlineView(frame: .zero) {
didSet {
outlineView.outlineDataSource = self
outlineView.outlineDelegate = self
}
}
@IBOutlet private(set) weak var outlineView: CatalystOutlineView!
than set outlineDataSource and outlineDelegate properties
outlineView.outlineDataSource = self
outlineView.outlineDelegate = self
func outlineView(_ outlineView: CatalystOutlineView, numberOfChildrenOfItem item: Any?) -> Int
func outlineView(_ outlineView: CatalystOutlineView, child index: Int, ofItem item: Any?) -> Any
func outlineView(_ outlineView: CatalystOutlineView, isItemExpandable item: Any) -> Bool
func outlineView(_ outlineView: CatalystOutlineView?, cellForItem item: Any?) -> UITableViewCell?
func outlineView(_ outlineView: CatalystOutlineView?, shouldCollapseItem item: Any?) -> Bool
func outlineView(_ outlineView: CatalystOutlineView?, didExpandItem item: Any?)
func outlineView(_ outlineView: CatalystOutlineView?, didCollapseItem item: Any?)
func view(forHeader outlineView: CatalystOutlineView?) -> UIView?
func height(forHeader outlineView: CatalystOutlineView?) -> CGFloat
func height(forCell outlineView: CatalystOutlineView?, ofItem item: Any?) -> CGFloat
// if you want context menu for your outlineView
func contextMenuConfiguration(for item: Any?) -> UIContextMenuConfiguration?
func expand()
func collapse()
Also you can check 'Example' project from repo!
CatalystOutlineViewDelegate is released under the MIT license. See LICENSE for details.