Skip to content

Types Reference ​

Complete reference of all public types in SwiftFlow.

Core Types ​

TypeDescription
Node<NodeData>Graph node with generic data
Edge<EdgeData>Graph edge with generic data
FlowEdgeType alias for Edge (avoids SwiftUI.Edge ambiguity)
EmptyEdgeDataEmpty data type for edges without custom data
ConnectionPending connection between handles
ViewportCamera state (pan + zoom)
XYPosition2D coordinate
InternalNode<T>Extended node with computed layout

Handle Types ​

TypeDescription
HandleType.source or .target
PositionHandle position: .top, .bottom, .left, .right
NodeHandleExplicit handle position and dimensions

Edge Types ​

TypeDescription
EdgeType.default, .bezier, .straight, .step, .smoothstep, .simplebezier
EdgeMarkerEndpoint marker configuration
MarkerType.arrow or .arrowClosed
EdgePathResultPath + label position result
ConnectionLineTypeType alias for EdgeType
EdgeStylePer-edge visual overrides

Change Types ​

TypeCases
NodeChange<T>.position, .selection, .remove, .add, .dimensions, .replace
EdgeChange<E>.selection, .remove, .add, .replace

State Management ​

TypeDescription
SwiftFlowStore<N, E>Centralized state management ObservableObject
SwiftFlowProvider<N, E, Content>View wrapper providing store to environment
SwiftFlowStateInternal canvas state (injected via environment)
SwiftFlowInstanceProgrammatic viewport and graph control
AnyNodeSnapshotType-erased node snapshot for overlays
AnyEdgeSnapshotType-erased edge snapshot for overlays
ConnectionStateIn-progress connection drag state

Component Types ​

TypeDescription
PanelPosition9-position enum for overlay placement
BackgroundVariant.dots, .lines, .cross
MiniMapNodePropsProperties for custom MiniMap nodes
ResizeDirection8-direction resize handle placement
ControlButtonStyled button for Controls panel
EdgeTextPositioned edge label with background

Configuration Types ​

TypeDescription
SwiftFlowThemeComprehensive theme with presets
FitViewOptionsFit-view animation and constraint configuration
DefaultEdgeOptionsDefault edge properties, applied when rendering and by addEdge
KeyboardShortcutsKey codes and nudge distances
AccessibilityConfigVoiceOver behavior and label texts
NodeStylePer-node visual overrides
EdgeStylePer-edge visual overrides

Constraint Types ​

TypeDescription
CoordinateExtentBoundary constraints for dragging
NodeExtent.parent or .coordinateExtent(CoordinateExtent)
NodeOriginNode anchor point (0–1 normalized)

Mode Enums ​

TypeValuesDescription
SelectionMode.partial, .fullSelection box containment mode
ConnectionMode.strict, .looseHandle connection validation
ColorMode.light, .dark, .systemColor scheme
ZIndexMode.auto, .basic, .manualZ-ordering strategy
PanOnScrollMode.free, .vertical, .horizontalScroll panning direction

Event Types ​

TypeDescription
IsValidConnectionType alias: (Connection) -> Bool
OnConnectStartParamsConnection start event data
BeforeDeleteResult.cancel or .delete(nodes: [Node], edges: [Edge])

Layout Types ​

TypeValues
LayoutAlgorithm.tree(...), .forceDirected(...), .grid(...)
LayoutDirection.topToBottom, .bottomToTop, .leftToRight, .rightToLeft

Serialization Types ​

TypeDescription
SwiftFlowDocument<N, E>Serializable graph snapshot

Utility Types ​

TypeDescription
KeyCodePlatform-agnostic key code with named constants
RectType alias for CGRect
SnapLineInternal type for snap alignment guides

Generic Constraints ​

All generic types in SwiftFlow follow these protocol requirements:

GenericRequired Conformance
NodeDataEquatable & Sendable
EdgeDataEquatable & Sendable & Hashable

For Codable support (serialization), both types must additionally conform to Codable.

SwiftUI-native node graph editor.