# `GSLayer connectPathsWithNode:andNode:`

*Instance Method*

Connects two path endpoints.

## Declaration

```swift
func connectPaths(with moveNode: GSNode, andNode overNode: GSNode) -> GSNode?
```

```objc
- (GSNode *) connectPathsWithNode:(GSNode *) moveNode andNode:(GSNode *) overNode;
```

```python
connectPathsWithNode_andNode_(moveNode: GSNode, overNode: GSNode) -> GSNode
```

## Return Value

The surviving node at the connection, or `nil` when the nodes cannot be connected.

## Discussion

Endpoints on different open paths join the paths. Endpoints on the same open path close it.

## See Also

### Connecting Paths

- [`GSLayer connectPathsWithNode:andNode:extendPath:`](/Core/GlyphsCore/GSLayer/connectPathsWithNode:andNode:extendPath:) — Connects two path endpoints and optionally adjusts their adjacent segments.
- [`GSLayer dividePathAtNode:`](/Core/GlyphsCore/GSLayer/dividePathAtNode:) — Opens or divides the path at a node.
- [`GSLayer reconnectNodesAtNode1:node2:offset:`](/Core/GlyphsCore/GSLayer/reconnectNodesAtNode1:node2:offset:) — Divides paths at two on-curve nodes and reconnects the resulting endpoints crosswise.
- [`GSLayer reconnectNodes:`](/Core/GlyphsCore/GSLayer/reconnectNodes:) — Reconnects four on-curve nodes according to their tangent directions.
- [`GSLayer connectAllOpenPaths`](/Core/GlyphsCore/GSLayer/connectAllOpenPaths) — Connects coincident endpoints of open paths.
- [`GSLayer closeOpenPaths:`](/Core/GlyphsCore/GSLayer/closeOpenPaths:) — Connects the nearest endpoints of a collection of open paths.

