How do I insert into Source List

I am using a Source List to display my data, here is my connection code @IBOutlet weak var listbox: NSOutlineView!, when inserting into it, it looks like nothing changed until you click the on the very top of the Source List then you select something,

here is my data source:

class MyDataSource: NSObject, NSOutlineViewDataSource {

    var items: [[String: String]] = []

    

    func outlineView(_ outlineView: NSOutlineView, numberOfChildrenOfItem item: Any?) -> Int {

        return items.count

    }

    

    func outlineView(_ outlineView: NSOutlineView, child index: Int, ofItem item: Any?) -> Any {

        return items[index]

    }



    

    func outlineView(_ outlineView: NSOutlineView, isItemExpandable item: Any) -> Bool {

        return false

    }

    

    func outlineView(_ outlineView: NSOutlineView, viewFor tableColumn: NSTableColumn?, item: Any) -> NSView? {

        let cell = outlineView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "MyCell"), owner: self) as! NSTableCellView

        cell.textField?.stringValue = item as? String ?? "error"

        return cell

    }

}

I am using Xcode 10.1, Can anyone help?

Could you show how items is populated ? In this partial code it remains empty.

.

when inserting into it

Could you show code where you do this ?

func insertItem(_ item: [String: String]) {

        dataSource.items.append(item) // data source is the data source object

        listbox.reloadData() // listbox is also defined

    }
How do I insert into Source List
 
 
Q