Files
e-party-iOS/yana/Configs/AppConfig.swift
edwinQQQ 007c10daaf feat: 添加Swift Package管理和API功能模块
新增Package.swift和Package.resolved文件以支持Swift Package管理,创建API相关文件(API.swift、APICaller.swift、APIConstants.swift、APIEndpoints.swift、APIService.swift、APILogger.swift、APIModels.swift、Integration-Guide.md)以实现API请求管理和网络交互功能,增强项目的功能性和可扩展性。同时更新.gitignore以排除构建文件和临时文件。
2025-06-04 17:25:21 +08:00

62 lines
1.4 KiB
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 "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
}
//
static var enableNetworkDebug: Bool {
#if DEBUG
return true
#else
return false
#endif
}
//
static var serverTrustPolicies: [String: ServerTrustEvaluating] {
#if DEBUG
return ["beta.api.molistar.xyz": DisabledTrustEvaluator()]
#else
return ["api.hfighting.com": PublicKeysTrustEvaluator()]
#endif
}
static var networkDebugEnabled: Bool {
#if DEBUG
return true
#else
return false
#endif
}
}