Instantly share code, notes, and snippets.

Embed
What would you like to do?
Swift Post Testability Example Code
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
let isUnitTesting = ProcessInfo.processInfo.environment["IS_UNIT_TESTING"] == "1"
if isUnitTesting == false {
// Do UI-related setup, which can be skipped when testing
}
return true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment