Skip to content

Commit af933ac

Browse files
committed
Add NodeID type parameter to ForceDescriptor
1 parent ac4b6e7 commit af933ac

File tree

10 files changed

+319
-174
lines changed

10 files changed

+319
-174
lines changed

Examples/ForceDirectedGraphExample/ForceDirectedGraphExample/Lattice.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ struct Lattice: View {
5050
}
5151

5252
} force: {
53-
LinkForce(
53+
LinkForce<Int>(
5454
originalLength: .constant(0.8),
5555
stiffness: .weightedByDegree { _, _ in 1.0 }
5656
)
57-
ManyBodyForce(strength: -0.8)
57+
ManyBodyForce<Int>(strength: -0.8)
5858
}
5959
.toolbar {
6060
GraphStateToggle(graphStates: graphStates)

Examples/ForceDirectedGraphExample/ForceDirectedGraphExample/MermaidVisualization.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ struct MermaidVisualization: View {
9999
.stroke(.black, StrokeStyle(lineWidth: 2.0, lineCap: .round, lineJoin: .round))
100100

101101
} force: {
102-
ManyBodyForce()
103-
LinkForce(originalLength: .constant(70))
104-
CenterForce()
102+
ManyBodyForce<String>()
103+
LinkForce<String>(originalLength: .constant(70))
104+
CenterForce<String>()
105105
} emittingNewNodesWithStates: { id in
106106
KineticState(position: getInitialPosition(id: id, r: 100))
107107
}

Examples/ForceDirectedGraphExample/ForceDirectedGraphExample/Miserables.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ struct MiserableGraph: View {
6666
}
6767

6868
} force: {
69-
ManyBodyForce(strength: -20)
70-
CenterForce()
71-
LinkForce(
69+
ManyBodyForce<String>(strength: -20)
70+
CenterForce<String>()
71+
LinkForce<String>(
7272
originalLength: .constant(35.0),
73-
stiffness: .weightedByDegree(k: { _, _ in 1.0})
73+
stiffness: .weightedByDegree { _, _ in 1.0}
7474
)
7575
}
7676
.ignoresSafeArea()

Examples/ForceDirectedGraphExample/ForceDirectedGraphExample/MyRing.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ struct MyRing: View {
4545
.stroke(.black, StrokeStyle(lineWidth: 1.5, lineCap: .round, lineJoin: .round))
4646

4747
} force: {
48-
ManyBodyForce(strength: -15)
49-
LinkForce(
48+
ManyBodyForce<Int>(strength: -15)
49+
LinkForce<Int>(
5050
originalLength: .constant(20.0),
51-
stiffness: .weightedByDegree(k: { _, _ in 3.0})
51+
stiffness: .weightedByDegree { _, _ in 3.0}
5252
)
53-
CenterForce()
54-
CollideForce()
53+
CenterForce<Int>()
54+
CollideForce<Int>()
5555
}
5656
.graphOverlay { proxy in
5757
Rectangle().fill(.clear).contentShape(Rectangle())

0 commit comments

Comments
 (0)