<!--
{
  "availability" : [
    "iOS: 27.3.0 -",
    "iPadOS: 27.3.0 -",
    "macOS: 27.3.0 -",
    "visionOS: 27.3.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SiriEvaluations",
  "identifier" : "/documentation/SiriEvaluations/UserTurn",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Siri Evaluations"
    ],
    "preciseIdentifier" : "s:15SiriEvaluations8UserTurnV"
  },
  "title" : "UserTurn"
}
-->

# UserTurn

A single utterance a person says, with what you expect Siri to do in response.

```
struct UserTurn
```

## Overview

A user turn is one thing the person says to Siri. Create a turn with only an
utterance to give Siri context for a later turn, or add a closure of expectations
to check what Siri does in response. A turn accepts [`Calls`](/documentation/SiriEvaluations/Calls), [`Finds`](/documentation/SiriEvaluations/Finds),
[`OnScreen`](/documentation/SiriEvaluations/OnScreen), [`Loads`](/documentation/SiriEvaluations/Loads), and [`SiriResponse`](/documentation/SiriEvaluations/SiriResponse) expectations. It compares them only
with that turn, so something Siri does in another turn can’t satisfy them.

Each turn has an [`id`](/documentation/SiriEvaluations/UserTurn/id). After a run, the framework matches each action Siri
performs to its turn by identifier. A run that stops early never checks one
turn’s expectations against another turn.

The following shows a turn that expects Siri to start a science quiz, not to
create a reminder, and to include the name of the topic in its reply:

```swift
let quizExampleIntents = IntentDefinitions(bundleIdentifier: "com.example.QuizExample")
let startQuizIntent = quizExampleIntents.intents["StartQuizIntent"]
let createQuizReminderIntent = quizExampleIntents.intents["CreateQuizReminderIntent"]

UserTurn("In QuizExample, start a science quiz with 5 questions") {
    Calls {
        startQuizIntent
            .expect(topic: .equals("Science"))
    }

    // Fails if Siri runs or asks the person to confirm the intent.
    Calls(.disallowed) {
        createQuizReminderIntent
    }

    // Checks if the reply names the topic.
    SiriResponse(.contains("Science"))
}
```

Place turns in a [`SiriScenario`](/documentation/SiriEvaluations/SiriScenario) to run them as a conversation.

## Topics

### Creating a user turn

[`init(String)`](/documentation/SiriEvaluations/UserTurn/init(_:))

Creates a turn with no expectations of its own.

### Creating a user turn with expectations

[`init(String, () -> SiriTurnExpectationBuilder.Component)`](/documentation/SiriEvaluations/UserTurn/init(_:_:))

Creates a turn from an utterance and what Siri should do in response to it.

[`enum SiriTurnExpectationBuilder`](/documentation/SiriEvaluations/SiriTurnExpectationBuilder)

A result builder that collects the expectations you attach to a user turn.

### Inspecting a user turn

[`let id: UUID`](/documentation/SiriEvaluations/UserTurn/id)

An identifier for the turn.

[`let utterance: String`](/documentation/SiriEvaluations/UserTurn/utterance)

The text a person says to Siri in this turn.

## Relationships

### Conforms To

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

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

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

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

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

---

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)