概要

毎日定時に「今日の勉強は始めましたか?少しずつ頑張りましょう!」のリマインダーを送る機能。 ローカル通知のみで、サーバー不要。

NotificationService API

final class NotificationService {
    static let shared: NotificationService

    func requestAuthorization() async throws
    func setEnabled(_ enabled: Bool, hour: Int, minute: Int)
    func scheduleDailyReminder(hour: Int, minute: Int)
}

通知ID

"dailyReminder"

処理フロー

  1. 初回 ON 時に requestAuthorization([.alert, .sound, .badge])
  2. 許可されたら UNCalendarNotificationTrigger を作成
  3. 毎日その時刻に通知配信
  4. OFF 時に removePendingNotificationRequests(withIdentifiers:)

変更履歴

バージョン日付変更内容
1.02026-05-09初版作成