Generic node graph editor. Generate a Patch from your own data model. Update
your data model when the Patch changes.
func simplePatch()->Patch{letgenerator=Node(name:"generator", outputs:["out"])letprocessor=Node(name:"processor", inputs:["in"], outputs:["out"])letmixer=Node(name:"mixer", inputs:["in1","in2"], outputs:["out"])letoutput=Node(name:"output", inputs:["in"])letnodes=[generator, processor, generator, processor, mixer, output]letwires=Set([Wire(from:OutputID(0,0), to:InputID(1,0)),Wire(from:OutputID(1,0), to:InputID(4,0)),Wire(from:OutputID(2,0), to:InputID(3,0)),Wire(from:OutputID(3,0), to:InputID(4,1)),Wire(from:OutputID(4,0), to:InputID(5,0))])varpatch=Patch(nodes: nodes, wires: wires)
patch.recursiveLayout(nodeIndex:5, at:CGPoint(x:800, y:50))return patch
}structContentView:View{@Statevarpatch=simplePatch()@Statevarselection=Set<NodeIndex>()varbody:someView{NodeEditor(patch: $patch, selection: $selection).onNodeMoved{ index, location inprint("Node at index \(index) moved to \(location)")}.onWireAdded{ wire inprint("Added wire: \(wire)")}.onWireRemoved{ wire inprint("Removed wire: \(wire)")}}}The API Reference can be found on the AudioKit Website. Package contains a demo project and a playground to help you get started quickly.
