Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Guides on-device Apple FoundationModels in iOS 26+ for text generation, @Generable structured output, tool calling, and snapshot streaming.
59% 100%+41 ptsof test cases passed
Passed 22 of 22 test cases with the skill, and 13 of 22 without it.
3 of 3 safety checks passed
Not used yet
使用 FoundationModels 框架将 Apple 的设备端语言模型集成到应用中的模式。涵盖文本生成、使用 @Generable 的结构化输出、自定义工具调用以及快照流式传输 —— 全部在设备端运行,以支持隐私保护和离线使用。
在创建会话(Session)之前,请务必检查模型的可用性:
struct GenerativeView: View {
private var model = SystemLanguageModel.default
var body: some View {
switch model.availability {
case .available:
ContentView()
case .unavailable(.deviceNotEligible):
Text("设备不符合 Apple Intelligence 的使用条件")
case .unavailable(.appleIntelligenceNotEnabled):
Text("请在设置中启用 Apple Intelligence")
case .unavailable(.modelNotReady):
Text("模型正在下载或尚未就绪")
case .unavailable(let other):
Text("模型不可用:\(other)")
}
}
}
Published skills whose descriptions closely match this one, with their benchmark result.
Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.