Created
June 5, 2015 16:43
-
-
Save netbe/552a0c7ee52a4869c5ba to your computer and use it in GitHub Desktop.
Solution to disable AppDelegate code in swift
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
import Foundation | |
import UIKit | |
func isRunningTests() -> Bool { | |
let environment = NSProcessInfo.processInfo().environment | |
if let injectBundle = environment["XCInjectBundle"] as? NSString { | |
return injectBundle.pathExtension == "xctest" | |
} | |
return false | |
} | |
class UnitTestsAppDelegate: UIResponder, UIApplicationDelegate | |
{ | |
} | |
if isRunningTests() { | |
UIApplicationMain(Process.argc, Process.unsafeArgv, NSStringFromClass(UIApplication), NSStringFromClass(UnitTestsAppDelegate)) | |
}else{ | |
UIApplicationMain(Process.argc, Process.unsafeArgv, NSStringFromClass(UIApplication), NSStringFromClass(AppDelegate)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This should work: