Advertisement
Guest User

Untitled

a guest
Jul 4th, 2015
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. // AppDelegate.swift
  2.  
  3. import UIKit
  4.  
  5. func isRunningTests() -> Bool {
  6. let environment = NSProcessInfo.processInfo().environment
  7. if let injectBundle = environment["XCInjectBundle"] as? NSString {
  8. return injectBundle.pathExtension == "xctest"
  9. }
  10. return false
  11. }
  12.  
  13. @UIApplicationMain
  14. class AppDelegate: UIResponder, UIApplicationDelegate {
  15.  
  16. override init() {
  17. super.init()
  18. if (isRunningTests()){
  19. // This bundle has unit tests injected. Let's not really start the app to avoid interfering with the tests.
  20. let infoDictionary:NSDictionary = NSBundle.mainBundle().infoDictionary!
  21. infoDictionary.setValue("UnitTests", forKey:"UIMainStoryboardFile")
  22. }
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement