Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // AppDelegate.swift
- import UIKit
- func isRunningTests() -> Bool {
- let environment = NSProcessInfo.processInfo().environment
- if let injectBundle = environment["XCInjectBundle"] as? NSString {
- return injectBundle.pathExtension == "xctest"
- }
- return false
- }
- @UIApplicationMain
- class AppDelegate: UIResponder, UIApplicationDelegate {
- override init() {
- super.init()
- if (isRunningTests()){
- // This bundle has unit tests injected. Let's not really start the app to avoid interfering with the tests.
- let infoDictionary:NSDictionary = NSBundle.mainBundle().infoDictionary!
- infoDictionary.setValue("UnitTests", forKey:"UIMainStoryboardFile")
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement