krz/daybyday

iOS app for children to learn days of the week, months, and seasons with audio assist.

clone: git clone https://gitbay.org/krz/daybyday.git

v1.3.2: DayByDay/DayByDayApp.swift · raw

 1//
 2//  DayByDayApp.swift
 3//  DayByDay
 4//
 5//  Created by cmc on 2026-03-09.
 6//
 7
 8import AVFoundation
 9import SwiftUI
10
11@main
12struct DayByDayApp: App {
13    init() {
14        Task.detached(priority: .background) {
15            // Activate the audio session early so the first real tap doesn't block.
16            try? AVAudioSession.sharedInstance().setCategory(.playback, mode: .default)
17            try? AVAudioSession.sharedInstance().setActive(true)
18
19            // Force singleton init (voice selection) and prime the TTS engine
20            // with a silent utterance so subsequent speaks are instant.
21            await MainActor.run {
22                let warmup = AVSpeechUtterance(string: "")
23                warmup.volume = 0
24                SpeechSynthesizer.shared.speakUtterance(warmup)
25            }
26        }
27    }
28
29    var body: some Scene {
30        WindowGroup {
31            ContentView()
32        }
33    }
34}