Created
June 4, 2021 20:31
-
-
Save zetrider/7037e3584609b25947608684ac6ca8ba to your computer and use it in GitHub Desktop.
Detect TestFlight, XCode, Simulator, AppStore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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