<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "GameplayKit",
  "identifier" : "/documentation/GameplayKit/GKGridGraph/diagonalsAllowed",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "GameplayKit"
    ],
    "preciseIdentifier" : "c:objc(cs)GKGridGraph(py)diagonalsAllowed"
  },
  "title" : "diagonalsAllowed"
}
-->

# diagonalsAllowed

A Boolean value that indicates whether nodes in the grid are connected to their diagonal neighbors.

```
var diagonalsAllowed: Bool { get }
```

## Discussion

If this property’s value is <doc://com.apple.documentation/documentation/Swift/true>, nodes in the grid are connected to their diagonal neighbors. If the value is <doc://com.apple.documentation/documentation/Swift/false>, nodes are connected only to their horizontal and vertical neighbors.

You specify this option when creating a grid graph with the [`init(fromGridStartingAt:width:height:diagonalsAllowed:)`](/documentation/GameplayKit/GKGridGraph/init(fromGridStartingAt:width:height:diagonalsAllowed:)) initializer. After initialization, you can use this property to examine the parameters the graph was created with—for example, to draw the grid as a debugging overlay in your game UI.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)