Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

Request Array with AppIntent

Hi everyone,

i'm trying to request in a AppIntent an array of strings. But I want to give the user the chance to add more than one String.

Yet, I do it so:

import AppIntent

struct AddHomework: AppIntent {
  // some Parameters

    @Parameter(title: "Tasks")
    var tasks: [String]?
    
    @Parameter(title: "New Task") //Only for the special request
    var input: String?
    
    private func collectTasks() async throws -> [String] {
        var collectedTasks: [String] = tasks ?? []
        
        while true {
            
            if !collectedTasks.isEmpty {
                let addMore = try await $input.requestConfirmation(for: "Möchtest du noch eine Aufgabe hinzufügen?")
                if !addMore {
                    break
                }
            }

            let newTask = try await $input.requestValue("Please enter your task:")
            collectedTasks.append(newTask)
        }
        
        return collectedTasks
    }
    
    @MainActor
    func perform() async throws -> some IntentResult {
        let finalTasks = try await collectTasks()
        
        // some more code
        return .result()
    }
}

But this is not working. The Shortcut is ending without requesting anything. But it is not crashing.

I would thankfully for some help.

Request Array with AppIntent
 
 
Q