---
title: "isConnectionLocked(from:to:)"
framework: gameplaykit
role: symbol
role_heading: Instance Method
path: "gameplaykit/gkobstaclegraph/isconnectionlocked(from:to:)"
---

# isConnectionLocked(from:to:)

Returns a Boolean value indicating whether the specified nodes are protected from disconnection due to the addition of obstacles.

## Declaration

```swift
func isConnectionLocked(from startNode: NodeType, to endNode: NodeType) -> Bool
```

## Parameters

- `startNode`: A node in the graph.
- `endNode`: Another node in the graph to which the node startNode is directly connected.

## Return Value

Return Value true if the connection between the specified nodes has been locked with the lockConnection(from:to:) method; otherwise, false.

## Discussion

Discussion By default, adding obstacles with the addObstacles(_:) method disconnects pairs of nodes if the direct path between them intersects an obstacle. This behavior ensures that using the findPathBetweenNodes:toNode: method does not result in a path through the graph that crosses obstacles. With certain nodes, this behavior might not be desirable—use the lockConnection(from:to:) method to protect a connection between nodes from being automatically destroyed and the unlockConnection(from:to:) method to remove such protection.

## See Also

### Locking Node Connections

- [lockConnection(from:to:)](gameplaykit/gkobstaclegraph/lockconnection(from:to:).md)
- [unlockConnection(from:to:)](gameplaykit/gkobstaclegraph/unlockconnection(from:to:).md)
