XcodeGen project (Notes / NotesMac / NotesTests), Swift 6 strict concurrency, iCloud-document storage via IndieSync with a SwiftData cache, automatic capture context (location, place, time zone, device) on every note, context-based relevance ranking with a 'Right here, right now' shelf, tags, search, and the square.and.pencil-on-red app icon.
25 lines
701 B
Swift
25 lines
701 B
Swift
import Foundation
|
|
import SwiftData
|
|
|
|
/// Owns all service objects; created asynchronously at launch and injected
|
|
/// into the SwiftUI environment.
|
|
@Observable
|
|
@MainActor
|
|
final class AppServices {
|
|
let modelContainer: ModelContainer
|
|
let syncEngine: SyncEngine
|
|
let contextService: ContextService
|
|
|
|
init() async {
|
|
let container = NotesModelContainer.make()
|
|
self.modelContainer = container
|
|
self.syncEngine = SyncEngine(modelContainer: container)
|
|
self.contextService = ContextService()
|
|
}
|
|
|
|
/// Slow startup work (iCloud container discovery) — runs after the UI is up.
|
|
func startDeferredServices() async {
|
|
await syncEngine.connect()
|
|
}
|
|
}
|