View the Project on GitHub fe9lix/Plumber



Plumber is a tiny Objective-C library for creating curved connection lines between nodes (for flowcharts, for example). The constructed path connects the bounding boxes such that the distance between two sides is minimized. I've created it since a quick Google search did not reveal anything simple for iOS. The curve calculation algorithm is a direct port of the function used in the Graffle Example of the vector drawing library Raphaƫl.


Just drag the folder Plumber/Plumber with its two classes Plumber and PlumberConnection into your Xcode project.

How to use it

The API couldn't be simpler: There's just one method connect that takes two CGRects (usually from a UIView or CALayer) and returns a new PlumberConnection, which is an immutable value object holding the original CGRects and the calculated UIBezierPath.

Plumber *plumber = [Plumber new];
PlumberConnection *connection = [plumber connectFrom:layerA.frame to:layerB.frame];
UIBezierPath *path = connection.path;
// draw the path...

See the example app (Plumber/Example) on how you could implement draggable shapes with their connection lines updated.


The MIT License