Contents

SiriResponse

An expectation that the reply Siri gives contains specific text.

Declaration

struct SiriResponse

Overview

Use SiriResponse to check the text of the reply Siri gives for a turn. Every check must hold, and each check passes when the reply contains the text you give. The text is plain text, not a pattern. A check is case-sensitive unless you pass false for caseSensitive. In the Xcode evaluation report, a check that fails shows the reply Siri gives next to the text it requires.

The wording Siri uses varies between runs even when Siri responds correctly, so name something the reply has to say, such as a topic or a name the person provides, not how Siri says it. To check a value that an intent receives or returns, use Calls instead. Use SiriResponse for details that appear only in the reply.

Check a reply on the turn that gives it. A turn accepts a SiriResponse, but the expectation closure of init(_:expectation:) doesn’t, because the reply belongs to a single turn.

The following example shows a turn that expects the reply to name the topic in any capitalization:

UserTurn("In QuizExample, start a science quiz with 5 questions") {
    SiriResponse(.contains("science", caseSensitive: false))
}

Topics

Creating a response expectation

Matching response text

See Also

Expectations