TreeView, TableView, swiftUI or Objective-C

OK, I'm a newbie beginner. I've found multiple examples of trying to implement a hierarchical TreeView/TableView for a recursive directory view. It would be fine if it's only MacOS app, but multiple would be great.
The best so far has been "NavigatingHierarchicalDataUsingOutlineAndSplitViews" in the Apple docs. But it is very complex for a newbie, uses a lot of @IB... from StoryBoard, so I'm thinking it's more objective-c verses swiftUI... since it's NSObjects and uses AppKit, But my biggest problem is how can you select a "cell" from the tree with the mouse and get the return value of the cell... "example - if I select with mouse a file with a click or double click, what I want returned is the URL and file name... I don't care if it's in "/Users/name/directory/xyx.txt" or file:/// formats. What I'm after is the path and the file name...

Yep, I'm over my head. I was able to implement this fairly easy with Tcl/Tk. If Apple is truly trying to unify apps to SwiftUI, I personally think they have a ways to go. Any help or pointers to good examples that work with Swift5.4 and Xcode 12.5 would be welcome. I've seen older examples but they were Xcode 9 with Swift 3.....
Thanks in advance everyone for your patience and I hope I'm posting this in the right area.... Also, if there are any great books with examples of using Xcode, I'd love to know what they are.


Have a look at this: SwiftUI Essentials - Building Lists and Navigation (Apple Developer Documentation) and SwiftUI (iOS 14) - Hierarchical Views (Medium blog post)

Like Tcl/Tk -- or any other UI framework -- SwiftUI handles user-interactions via events. For example: onTapGesture(count:perform:) (Apple Developer Documentation)

Good luck!

1 Like

Thanks, appreciate the response.

Terms of Service

Privacy Policy

Cookie Policy