---
title: "didBegin(_:)"
framework: spritekit
role: symbol
role_heading: Instance Method
path: "spritekit/skphysicscontactdelegate/didbegin(_:)"
---

# didBegin(_:)

Called when two bodies first contact each other.

## Declaration

```swift
optional func didBegin(_ contact: SKPhysicsContact)
```

## Parameters

- `contact`: An object that describes the contact.

## Discussion

Discussion The two physics bodies described in the contact parameter are not passed in a guaranteed order. The following code shows how you might respond to the beginning of a contact event to execute code if either physics body is owned by a node with the name ground. Listing 1. Responding to a contact event. func didBegin(_ contact: SKPhysicsContact) {     if contact.bodyA.node?.name == "ground" || contact.bodyB.node?.name == "ground" {         // execute code to respond to object hitting ground     } }

## See Also

### Responding to Contact Events

- [didEnd(_:)](spritekit/skphysicscontactdelegate/didend(_:).md)
