gringoireDM / LNZTreeView

A swift TreeView
MIT License
235 stars 47 forks source link

Question about "didSelectNodeAt indexPath:" #5

Closed saormart closed 6 years ago

saormart commented 6 years ago

First, nice framework! So, I'm trying to use the following function to get the selected node to perform a segue: treeView(_ treeView: LNZTreeView, didSelectNodeAt indexPath: IndexPath, forParentNode parentNode: TreeNode?) but in the project it's not called if I add it to my viewController! M'I doing something wrong ? Thanks!

batuhankok commented 6 years ago

@saormart Hi!

extension MarksVC: LNZTreeViewDelegate {

    func treeView(_ treeView: LNZTreeView, didSelectNodeAt indexPath: IndexPath, forParentNode parentNode: TreeNodeProtocol?) {

    }

    func treeView(_ treeView: LNZTreeView, didExpandNodeAt indexPath: IndexPath, forParentNode parentNode: TreeNodeProtocol?) {

    }

    func treeView(_ treeView: LNZTreeView, didCollapseNodeAt indexPath: IndexPath, forParentNode parentNode: TreeNodeProtocol?) {

    }

}
gringoireDM commented 6 years ago

Hi @saormart this is an xCode issue I'm experiencing as well. And it's given by the fact that none of the three methods is optional, so when xCode checks for conformance to the protocol gives out on missing methods, but then it tries to understand if you actually implemented the missing method, but you spelled it. Since the methods are similar Xcode proposes a change. Writing all the three methods will solve the issue.

saormart commented 6 years ago

Thanks guys !