widgetkit-code-review
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWidgetKit Code Review
WidgetKit 代码评审
Quick Reference
快速参考
| Issue Type | Reference |
|---|---|
| TimelineProvider, entries, reload policies | references/timeline.md |
| Widget families, containerBackground, deep linking | references/views.md |
| AppIntentConfiguration, EntityQuery, @Parameter | references/intents.md |
| Refresh budget, memory limits, caching | references/performance.md |
| 问题类型 | 参考链接 |
|---|---|
| TimelineProvider、entries、重载策略 | references/timeline.md |
| Widget 系列、containerBackground、深度链接 | references/views.md |
| AppIntentConfiguration、EntityQuery、@Parameter | references/intents.md |
| 刷新预算、内存限制、缓存 | references/performance.md |
Review Checklist
评审检查清单
- returns immediately without async work
placeholder(in:) - Timeline entries spaced at least 5 minutes apart
- checks
getSnapshotfor gallery previewscontext.isPreview - used for iOS 17+ compatibility
containerBackground(for:) - used for systemSmall (not Link)
widgetURL - No Button views (use Link or widgetURL)
- No AsyncImage or UIViewRepresentable in widget views
- Images downsampled to widget display size (~30MB limit)
- App Groups configured for data sharing between app and widget
- EntityQuery implements for non-optional parameters
defaultResult() - New intent parameters handle nil for existing widgets after updates
- called strategically (not on every data change)
reloadTimelines
- 立即返回,不执行异步操作
placeholder(in:) - 时间线条目间隔至少5分钟
- 针对图库预览检查
getSnapshotcontext.isPreview - 使用 以兼容iOS 17+
containerBackground(for:) - 针对systemSmall尺寸使用 (而非Link)
widgetURL - 不使用Button视图(改用Link或widgetURL)
- 小组件视图中不使用AsyncImage或UIViewRepresentable
- 图片已下采样至小组件显示尺寸(约30MB限制)
- 已配置App Groups以实现应用与小组件之间的数据共享
- EntityQuery 为非可选参数实现了
defaultResult() - 新增的意图参数在更新后能处理现有小组件的nil值
- 策略性调用 (而非每次数据变更都调用)
reloadTimelines
When to Load References
何时查阅参考资料
- TimelineProvider implementation or refresh issues -> timeline.md
- Widget sizes, Lock Screen, containerBackground -> views.md
- Configurable widgets, AppIntent migration -> intents.md
- Memory issues, caching, budget management -> performance.md
- TimelineProvider 实现或刷新问题 -> timeline.md
- 小组件尺寸、锁屏、containerBackground -> views.md
- 可配置小组件、AppIntent 迁移 -> intents.md
- 内存问题、缓存、预算管理 -> performance.md
Review Questions
评审问题
- Does the widget provide fallback entries for when system delays refresh?
- Are Lock Screen families (accessoryCircular/Rectangular/Inline) handled appropriately?
- Would migrating from IntentConfiguration break existing user widgets?
- Is timeline populated with future entries or does it rely on frequent refreshes?
- Is data cached via App Groups for widget access?
- 当系统延迟刷新时,小组件是否提供了备用条目?
- 锁屏系列(accessoryCircular/Rectangular/Inline)是否得到了恰当处理?
- 从IntentConfiguration迁移是否会破坏现有用户的小组件?
- 时间线是否填充了未来条目,还是依赖频繁刷新?
- 是否通过App Groups缓存数据以供小组件访问?