---
title: "withCollisions(_:)"
framework: realitykit
role: symbol
role_heading: Instance Method
path: "realitykit/clothcolliderevents/newbodycollisions/withcollisions(_:)"
---

# withCollisions(_:)

Provides access to the collisions with cloth bodies that took place.

## Declaration

```swift
func withCollisions<Result>(_ callback: (Span<ClothColliderEvents.NewBodyCollisions.Collision>) -> Result) -> Result
```

## Parameters

- `callback`: A closure that receives a span over the collisions.

## Return Value

Return Value The value returned by callback.

## Discussion

Discussion This span is only available during the subscription callback of this event. The provided span is only valid for the lifetime of the callback.

## See Also

### Accessing collision data

- [collisions](realitykit/clothcolliderevents/newbodycollisions/collisions.md)
- [ClothColliderEvents.NewBodyCollisions.Collision](realitykit/clothcolliderevents/newbodycollisions/collision.md)
