Skip to content

Instantly share code, notes, and snippets.

@azamsharp
Created December 3, 2017 18:17
Show Gist options
  • Save azamsharp/d2dfe23384231c5683a27435cef446fb to your computer and use it in GitHub Desktop.
Save azamsharp/d2dfe23384231c5683a27435cef446fb to your computer and use it in GitHub Desktop.
Reset Test Cleanup
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
resetUserDefaults()
return true
}
private func resetUserDefaults() {
if ProcessInfo.processInfo.arguments.contains("UI-Testing") {
UserDefaults.standard.removePersistentDomain(forName: Bundle.main.bundleIdentifier!)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment