本体↔Widget間のデータ共有
AppGroup UserDefaults 経由で本体・Widget間のデータを共有。本体起動時およびセッション保存後に同期。
final class WidgetSyncService {
static let shared: WidgetSyncService
func syncToWidget(
todaySeconds: Int,
dailyGoal: Int,
streak: Int,
accentHex: String
)
// → AppGroup UserDefaults に書込 + WidgetCenter.shared.reloadAllTimelines()
}
| キー | 型 |
|---|---|
todayStudySeconds | Int |
dailyGoalMinutes | Int |
streakDays | Int |
themeAccentHex | String |
| バージョン | 日付 | 変更内容 |
|---|---|---|
| 1.0 | 2026-05-09 | 初版作成 |