Files
scan-receipts/app/ios/ScanReceipts/Networking/APIEnvironment.swift

31 lines
997 B
Swift

import Foundation
/// Which backend the app talks to. All three point at the *same* Next.js API
/// described in `app/ios/README.md` there is no separate mobile backend.
enum APIEnvironment {
case production
case local
var baseURL: URL {
switch self {
case .production:
// TODO: swap for the real production domain before release.
return URL(string: "https://scan-receipts.app")!
case .local:
// Matches `dev-verify` in the web repo's .claude/launch.json (port
// 3901) so the app can be pointed at a live local backend without
// colliding with the docker-compose stack on 3000. Only reachable
// from an iOS Simulator on the same machine, not a physical device.
return URL(string: "http://localhost:3901")!
}
}
static var current: APIEnvironment {
#if DEBUG
return .local
#else
return .production
#endif
}
}