
新增.gitignore、Podfile和Podfile.lock文件以管理项目依赖,添加README.md文件提供项目简介和安装步骤,创建NIMSessionManager、ClientConfig、LogManager和NetworkManager等管理类以支持网络请求和日志记录功能,更新AppDelegate和ContentView以集成NIM SDK和实现用户登录功能。
36 lines
823 B
Swift
36 lines
823 B
Swift
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 "http://beta.api.molistar.xyz"
|
||
case .production:
|
||
return "https://api.hfighting.com"
|
||
}
|
||
}
|
||
|
||
// 添加更多环境变量
|
||
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
|
||
}
|
||
} |