fix(skills): improve code examples in iOS 26 skills

- Add do-catch error handling to SwiftUI streaming example in
  foundation-models-on-device
- Add Auto Layout constraints to UIKit glass effect example in
  liquid-glass-design
- Promote build settings prerequisite from code comment to visible
  blockquote warning in swift-concurrency-6-2
This commit is contained in:
Okmin
2026-02-24 14:39:25 +09:00
parent 1e79991407
commit 300b6715f9
3 changed files with 27 additions and 6 deletions

View File

@@ -178,6 +178,7 @@ for try await partial in stream {
```swift
@State private var partialResult: TripIdeas.PartiallyGenerated?
@State private var errorMessage: String?
var body: some View {
List {
@@ -185,10 +186,17 @@ var body: some View {
Text(idea)
}
}
.overlay {
if let errorMessage { Text(errorMessage).foregroundStyle(.red) }
}
.task {
let stream = session.streamResponse(to: prompt, generating: TripIdeas.self)
for try await partial in stream {
partialResult = partial
do {
let stream = session.streamResponse(to: prompt, generating: TripIdeas.self)
for try await partial in stream {
partialResult = partial
}
} catch {
errorMessage = error.localizedDescription
}
}
}