Graph editor in swift - where to start?

Hello, everyone!
I have a project idea that involves creating a graph editor - an area in the gui where I can right click to place a vertex, drag the mouse between two vertices to connect them with an edge, drag the "canvas" to move the graph around, zoom in and out, etc and use these for various graph theory related calculations. Important note: I am only targeting macOS, not iOS for now.

However, I am an absolute beginner in swift and gui development (I am quite confident with programming overall, just new to swift and GUIs), and I am a bit lost as to what swiftUI tools I should look into to start implementing this idea. I have looked into apple's tutorials, the playgrounds etc but they all seem to mainly cover buttons, text, shapes in a VStack and HStack etc and not much on any "draggable canvas"-esque elements that I seem to require, and I don't even know what the views/tools I might need are called, so I was hoping to ask for some initial directions :)

Thank you very much in advance!

2 Likes

I'd start with drawing Drawing paths and shapes | Apple Developer Documentation and later add gestures Gestures | Apple Developer Documentation.

Those articles I have added might be a good starting point.

I'd also note, that this forum is not meant for discussion of Apple frameworks. There is an Apple forum for that.

4 Likes

Thank you! I believe this is what I was looking for, much appreciated :)
Also thank you for pointing the apple forum out, I'll move my further inquiries there

3 Likes

The Grape library might be useful to you, at least for the graph rendering and basic interaction.

3 Likes

This one is absolutely spot on, thank you very much!!!