Files
shaguabijia-app-ios/App/Networking/AppConfig.swift
T
marco 98b7600797 初始化傻瓜比价正式版 iOS 客户端
对标安卓正式版、对接 app-server(8770)的 SwiftUI 客户端。iOS 无障碍受限、无比价核心,做自成一体:美团 CPS 导购 + 福利(签到/任务/金币)+ 查看(比价记录/省钱战绩)。
功能完整 M0-M5:脚手架、短信登录(JWT+Keychain+401 自动刷新)、首页券 feed 导购、比价记录+省钱战绩、福利、我的(资料/反馈/设置/注销)。
单 target、0 三方依赖、XcodeGen 生成工程;Debug/Release 双 plist 分流 ATS。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-05 00:54:11 +08:00

28 lines
1.2 KiB
Swift

import Foundation
/// debug /( SHAGUA_API_BASE_URL ,),
/// release 线 BuildConfig.BASE_URL debug/release
enum AppConfig {
static let apiBaseURL: URL = {
#if DEBUG
if let raw = ProcessInfo.processInfo.environment["SHAGUA_API_BASE_URL"],
let url = URL(string: raw) {
return url
}
// / IP( 127.0.0.1 ,)
// WiFi IP , `ipconfig getifaddr en0` ()
return URL(string: "http://192.168.0.119:8770")!
#else
return URL(string: "https://app-api.shaguabijia.com")!
#endif
}()
/// (/media/...) URL,/
static func mediaURL(_ path: String?) -> URL? {
guard let path, !path.isEmpty else { return nil }
if path.hasPrefix("http") { return URL(string: path) }
let sep = path.hasPrefix("/") ? "" : "/"
return URL(string: apiBaseURL.absoluteString + sep + path)
}
}