Request array with AppIntents

Hi,

I’m trying to get an array of strings from the user using AppIntents, but I’m encountering an issue. The shortcut ends without prompting the user for input or saving the value, though it doesn’t crash. I need to get the user to input multiple tasks in an array, but the current approach isn’t working as expected.

Here’s the current method I’m using:

// Short code snippet showing the current method
private func collectTasks() async throws -> [String] {
    var collectedTasks: [String] = tasks ?? []
    
    while true {
        if !collectedTasks.isEmpty {
            let addMore = try await $input.requestConfirmation("Would you like to add another task?")
            if !addMore {
                break
            }
        }
        
        let newTask = try await $input.requestValue("Please enter a task:")
        collectedTasks.append(newTask)
    }
    
    return collectedTasks
}

The Call

func perform() async throws -> some IntentResult {
      let finalTasks = try await collectTasks()
      // Some more Code
}

Any advice or suggestions would be appreciated. Thanks in advance!

Request array with AppIntents
 
 
Q