Librechat-Mobile/iosApp/iosApp/KoinHelper.swift
Garfie 770603e466 KMP iOS migration
Complete Kotlin Multiplatform migration with iOS parity:
- All 13 modules converted to KMP (commonMain + androidMain + iosMain)
- 100% feature parity: auth, chat, SSE streaming, conversations,
  settings, agents, files, voice input, TTS, OAuth, file picker,
  clipboard paste
- Platform consolidation: DataStore path, SessionCacheCleaner,
  bubble layouts, ChatInput core, MIME types, mention parsing,
  TextField styling, FilterChip components extracted to commonMain
- iOS crash reporting via Kotlin/Native exception hook
- YAML parsing via custom pure-Kotlin parser (zero dependencies)
- Dependency health: Timber removed, kaml replaced, FuzzyWuzzy removed,
  security-crypto stabilized
- CONTRIBUTING.md
- Gradle configuration cache enabled
2026-04-02 19:54:58 -05:00

37 lines
1.2 KiB
Swift

import Foundation
import Shared
/// Helper to resolve Koin dependencies from Swift.
/// Uses IosKoinAccessor (Kotlin-side) to avoid exposing Koin internals to Swift.
/// Koin is started in iOSApp.init() via IosKoinHelperKt.startIosKoin().
///
/// All accessors use try! because these are startup-time singletons that must
/// resolve. If Koin is misconfigured, we want a clear crash with the Koin error
/// message rather than a mysterious SIGABRT from trapOnUndeclaredException.
enum KoinHelper {
static var sdk: LibreChatSDK {
try! IosKoinAccessor.shared.getSDK()
}
static var serverDataStore: ServerDataStore {
try! IosKoinAccessor.shared.getServerDataStore()
}
/// The streaming-qualified HttpClient for SSE connections
static var streamingHttpClient: Ktor_client_coreHttpClient {
try! IosKoinAccessor.shared.getStreamingHttpClient()
}
static var authRepository: any AuthRepository {
try! IosKoinAccessor.shared.getAuthRepository()
}
static var fileRepository: any FileRepository {
try! IosKoinAccessor.shared.getFileRepository()
}
static var configRepository: any ConfigRepository {
try! IosKoinAccessor.shared.getConfigRepository()
}
}