Skip to content

Instantly share code, notes, and snippets.

@LutherBaker
Forked from JARinteractive/main.swift
Created July 31, 2017 22:31
Show Gist options
  • Save LutherBaker/086e561a1f2e6eff6946321ac39a7f9a to your computer and use it in GitHub Desktop.
Save LutherBaker/086e561a1f2e6eff6946321ac39a7f9a to your computer and use it in GitHub Desktop.
simple main.swift to prevent running apps during unit testing
import UIKit
private func delegateClassName() -> String? {
guard NSClassFromString("XCTestCase") == nil else { return nil }
return NSStringFromClass(AppDelegate)
}
UIApplicationMain(Process.argc, Process.unsafeArgv, nil, delegateClassName())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment