<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "swift: 5.9.0 -",
    "tvOS: 18.0.0 -",
    "visionOS: 2.0.0 -",
    "watchOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftData",
  "identifier" : "/documentation/SwiftData/HistoryDescriptor",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "SwiftData"
    ],
    "preciseIdentifier" : "s:9SwiftData17HistoryDescriptorV"
  },
  "title" : "HistoryDescriptor"
}
-->

# HistoryDescriptor

A type that describes the criteria, and, optionally, sort order, to use when fetching history data

```
struct HistoryDescriptor<TransactionType> where TransactionType : HistoryTransaction
```

## Topics

### Creating a descriptor

[`init(predicate:)`](/documentation/SwiftData/HistoryDescriptor/init(predicate:))

Initializes a new history descriptor with the provided predicate.

[`init(predicate:sortBy:)`](/documentation/SwiftData/HistoryDescriptor/init(predicate:sortBy:))

Initializes a new history descriptor with the provided predicate and sort descriptor.

### Getting the descriptor configuration

[`fetchLimit`](/documentation/SwiftData/HistoryDescriptor/fetchLimit)

The maximum number of transactions to retrieve from the model store’s history.

[`predicate`](/documentation/SwiftData/HistoryDescriptor/predicate)

The predicate used to initialize the history descriptor.

[`sortBy`](/documentation/SwiftData/HistoryDescriptor/sortBy)

The sort descriptor to use to sort the returned history data.



---

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)