feat: 添加NIMConfigurationManager和AppConfig文件

添加NIMConfigurationManager用于初始化NIM SDK,并创建AppConfig以管理应用环境配置,包括基础URL和Analytics Key等
This commit is contained in:
AI Health Developer
2025-04-27 15:13:47 +08:00
parent 68188119bb
commit 374cc654d7
2 changed files with 46 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
enum Environment {
case development
case production
}
struct AppConfig {
static var current: Environment = {
#if DEBUG
return .development
#else
return .production
#endif
}()
static var baseURL: String {
switch current {
case .development:
return "https://dev-api.yourdomain.com/v1"
case .production:
return "https://api.yourdomain.com/v1"
}
}
//
static var analyticsKey: String {
switch current {
case .development: return "dev_analytics_key"
case .production: return "prod_analytics_key"
}
}
//
static func switchEnvironment(to env: Environment) {
current = env
}
}