Visualizing Graphs in Swift
summary
Recreates the D3 force-directed demo in Swift 3, building an interactive graph that doubles as a physics sim and runs inside a playground. Implements Coulomb repulsion, spring edges and a centering force, updates each frame via CADisplayLink and integrates motion with verlet integration. Uses a quad tree Barnes-Hut approximation to drop O(n^2) repulsion to ~O(n log n), adds Unmanaged pointers and fixed nodes for drag performance, handles hundreds of nodes smoothly and the demo and code are published on GitHub.
AI-written summary · about
chapters (7)
- 0:00Start
- 1:22Scroll view rubber banding and friction
- 7:03Velocity Verlet
- 9:03Force Directed Graph Layout
- 9:49Coulomb's Law
- 11:29Barnes-Hut Approximation
- 15:10Springs
related talks
25mDrawing Graphs with SwiftUI
40mWith Beams and Cannons — How to Spice Up D3 Graphs with a Physics Engine
21mData Visualizations with React + D3
33mPainting with Data
24mBeyond the bar graph: Creative visualization with D3.js
26mHooked on D3: Creating Animated Ch(art)s with D3 and React
32mD3 and React, Together
12mBattle-Tested Techniques for Animation & Data Viz
