---
title: "comparePositionInDecodeOrder(withPositionOf:)"
framework: avfoundation
role: symbol
role_heading: Instance Method
path: "avfoundation/avsamplecursor/comparepositionindecodeorder(withpositionof:)"
---

# comparePositionInDecodeOrder(withPositionOf:)

Compares the relative positions of two sample cursors and returns their relative positions.

## Declaration

```swift
func comparePositionInDecodeOrder(withPositionOf cursor: AVSampleCursor) -> ComparisonResult
```

## Parameters

- `cursor`: An instance of AVSampleCursor with which to compare positions.

## Return Value

Return Value Returns a comparison result that indicates of this cursor points at a sample before, the same as, or after the sample pointed to by the specified cursor.

## Discussion

Discussion Undefined results occur if this cursor and the passed in cursor reference different sequences of samples, such as when they’re created by different instances of AVAssetTrack.
