Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Detect TestFlight, XCode, Simulator, AppStore
enum Environment: String {
case production = "production"
case development = "development"
}
func env() -> Environment {
// TestFLight, Xcode
if Bundle.main.appStoreReceiptURL?.lastPathComponent == "sandboxReceipt" {
return .development
}
// Simulator
#if targetEnvironment(simulator)
return .development
#else
return .production
#endif
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment