summaryrefslogtreecommitdiff
path: root/DayByDay/DayByDayApp.swift
diff options
context:
space:
mode:
Diffstat (limited to 'DayByDay/DayByDayApp.swift')
-rw-r--r--DayByDay/DayByDayApp.swift17
1 files changed, 17 insertions, 0 deletions
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()