fix(skills): address code review feedback on iOS 26 skill examples

- Add required name/description properties and @Generable to RecipeSearchTool
- Fix missing argument label in session.respond(to:) call
- Remove non-existent .scrollExtensionMode API, replace with correct guidance
- Change PhotoProcessor from struct to class for cache mutation support
- Fix method name mismatch in @concurrent example caller
This commit is contained in:
Okmin
2026-02-19 12:15:41 +09:00
parent 3b8c157952
commit 0a770caf84
3 changed files with 12 additions and 11 deletions

View File

@@ -113,7 +113,11 @@ Let the model invoke custom code for domain-specific tasks:
```swift
struct RecipeSearchTool: Tool {
struct Arguments: Codable {
let name = "recipe_search"
let description = "Search for recipes matching a given term and return a list of results."
@Generable
struct Arguments {
var searchTerm: String
var numberOfResults: Int
}
@@ -139,7 +143,7 @@ let response = try await session.respond(to: "Find me some pasta recipes")
```swift
do {
let answer = try await session.respond("Find a recipe for tomato soup.")
let answer = try await session.respond(to: "Find a recipe for tomato soup.")
} catch let error as LanguageModelSession.ToolCallError {
print(error.tool.name)
if case .databaseIsEmpty = error.underlyingError as? RecipeSearchToolError {