Files
e-party-iOS/yana/Configs/AppConfig.swift
AI Health Developer 374cc654d7 feat: 添加NIMConfigurationManager和AppConfig文件
添加NIMConfigurationManager用于初始化NIM SDK,并创建AppConfig以管理应用环境配置,包括基础URL和Analytics Key等
2025-04-27 15:13:47 +08:00

36 lines
832 B
Swift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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
}
}