Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save zetrider/7037e3584609b25947608684ac6ca8ba to your computer and use it in GitHub Desktop.
Save zetrider/7037e3584609b25947608684ac6ca8ba to your computer and use it in GitHub Desktop.
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