diff --git a/README.md b/README.md index d6f21a9..25ad803 100644 --- a/README.md +++ b/README.md @@ -86,17 +86,18 @@ struct MyGraph: View { @State var isRunning = true // start moving once appeared. var body: some View { - ForceDirectedGraph(isRunning: $isRunning) { + ForceDirectedGraph($isRunning) { // Declare nodes and links like you would do in Swift Charts. - NodeMark(id: 0, fill: .green) - NodeMark(id: 1, fill: .blue) - NodeMark(id: 2, fill: .yellow) - for i in 0..<2 { + NodeMark(id: 0).foregroundStyle(.green) + NodeMark(id: 1).foregroundStyle(.blue) + NodeMark(id: 2).foregroundStyle(.yellow) + + ForEach(Array(0..<2), id:\.self) { i in LinkMark(from: i, to: i+1) } - } forceField: { + } force: { LinkForce() CenterForce() ManyBodyForce()