 //  THE SOFTWARE.
 //
 
+#if canImport(AppKit)
+
 import Foundation
 import AppKit
 import ReactiveKit

    Element: ObservableCollectionEventProtocol, Element.UnderlyingCollection.Index == Int, Error == NoError {

    @discardableResult
    public func bind(to tableView: NSTableView, animated: Bool = true, createCell: @escaping (UnderlyingCollection, Int, NSTableView) -> NSView?) -> Disposable {
        let binder = TableViewBinder(measureCell: nil, createCell: createCell)
        if !animated {
            binder.deleteAnimation = nil

        disposable += tableView.reactive.delegate.feed(
            property: dataSource,
            to: #selector(NSTableViewDelegate.tableView(_:viewFor:row:)),
            map: { (dataSource: UnderlyingCollection?, tableView: NSTableView, tableColumn: NSTableColumn, row: Int) -> NSView? in
                guard let dataSource = dataSource else { return nil }
                return binder.cellForRow(at: row, tableColumn: tableColumn, tableView: tableView, dataSource: dataSource)
            }
        )

