<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVSampleCursor/comparePositionInDecodeOrder(withPositionOf:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(cs)AVSampleCursor(im)comparePositionInDecodeOrderWithPositionOfCursor:"
  },
  "title" : "comparePositionInDecodeOrder(withPositionOf:)"
}
-->

# comparePositionInDecodeOrder(withPositionOf:)

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

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

## Parameters

`cursor`

An instance of `AVSampleCursor` with which to compare positions.

## 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

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`](/documentation/AVFoundation/AVAssetTrack).

---

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)