Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
li3zhen1 authored Jan 3, 2024
1 parent bf540e7 commit a81c887
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit a81c887

Please sign in to comment.