What exactly do you mean by application name token? Here is an example of my current implementation.
struct CreateExercise: AppIntent {
static var title: LocalizedStringResource = "Create Exercise"
static var parameterSummary: some ParameterSummary {
Summary("Create \(\.$name)")
}
@Parameter(title: "Exercise Name")
var name: String
func perform() async throws -> some IntentResult {
async let exercises = ExerciseQuery().suggestedEntities()
var newExercise: FEExercise?
if let user = Auth.auth().currentUser {
let creator = ExerciseCreator(uid: user.uid)
let id = try await creator.addExercise(name: name, existingExercises: exercises)
newExercise = try await ExerciseQuery().entities(for: [id.documentID]).first
return .result(value: newExercise)
}
return .result(value: newExercise)
}
}
@available(iOS 16.0, *)
struct SetgraphShortcuts: AppShortcutsProvider {
static var shortcutTileColor: ShortcutTileColor = .lime
static var appShortcuts: [AppShortcut] = [
AppShortcut(intent: RecordSet(), phrases: ["Record Set in Setgraph", "Record Set", "Log Set", "Record a Set", "Log a Set"], systemImageName: "dumbbell"),
AppShortcut(intent: CreateExercise(), phrases: ["Create Exercise in Setgraph", "Create Exercise", "New Exercise", "Create a Exercise", "Create a New Exercise"], systemImageName: "dumbbell")
]
}
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: