From c53a320698c17d98477c0384f1f644da9735f645 Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Sat, 14 Mar 2026 09:56:39 -0500 Subject: implement more learning categories --- DayByDay/DayByDayApp.swift | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'DayByDay/DayByDayApp.swift') diff --git a/DayByDay/DayByDayApp.swift b/DayByDay/DayByDayApp.swift index 2cce4db..860d747 100644 --- a/DayByDay/DayByDayApp.swift +++ b/DayByDay/DayByDayApp.swift @@ -5,10 +5,27 @@ // Created by cmc on 2026-03-09. // +import AVFoundation import SwiftUI @main struct DayByDayApp: App { + init() { + Task.detached(priority: .background) { + // Activate the audio session early so the first real tap doesn't block. + try? AVAudioSession.sharedInstance().setCategory(.playback, mode: .default) + try? AVAudioSession.sharedInstance().setActive(true) + + // Force singleton init (voice selection) and prime the TTS engine + // with a silent utterance so subsequent speaks are instant. + await MainActor.run { + let warmup = AVSpeechUtterance(string: "") + warmup.volume = 0 + SpeechSynthesizer.shared.speakUtterance(warmup) + } + } + } + var body: some Scene { WindowGroup { ContentView() -- cgit v1.2.3