<!--
{
  "availability" : [
    "Xcode: 27.0.0 -",
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "visionOS: 27.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Evaluations",
  "identifier" : "/documentation/Evaluations/ArrayLoader",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Evaluations"
    ],
    "preciseIdentifier" : "s:11Evaluations11ArrayLoaderV"
  },
  "title" : "ArrayLoader"
}
-->

# ArrayLoader

A loader backed by an in-memory array.

```
struct ArrayLoader<Sample> where Sample : SampleProtocol
```

## Overview

```swift
let loader = ArrayLoader(samples: [
    ModelSample(prompt: "What is 2+2?", expected: "4"),
    ModelSample(prompt: "What is the capital of France?", expected: "Paris"),
])
```

## Topics

### Initializers

[`init(samples: [Sample])`](/documentation/Evaluations/ArrayLoader/init(samples:))

Creates a loader backed by the given array of samples.

### Instance Properties

[`var stream: any AsyncSequence<Sample, any Error>`](/documentation/Evaluations/ArrayLoader/stream)

The async sequence that yields each sample in the array during an evaluation run.

## Relationships

### Conforms To

[`Sendable`](/documentation/Swift/Sendable)

[`Loader`](/documentation/Evaluations/Loader)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

---

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)