Skip to content

Instantly share code, notes, and snippets.

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
return .production
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment