AppDelegate.swift 751 B

1234567891011121314151617181920212223242526272829
  1. //
  2. // AppDelegate.swift
  3. // TestSwift
  4. //
  5. // Created by Damian Kolakowski on 05/06/14.
  6. // Copyright (c) 2014 Damian Kołakowski. All rights reserved.
  7. //
  8. import Foundation
  9. import UIKit
  10. @UIApplicationMain
  11. class AppDelegate: UIResponder, UIApplicationDelegate {
  12. var window: UIWindow?
  13. let server = demoServer()
  14. func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool {
  15. if let resDir = NSBundle.mainBundle().resourcePath {
  16. server["/resources/(.+)"] = HttpHandlers.directory(resDir)
  17. }
  18. var error: NSError?
  19. if !server.start(error: &error) {
  20. println("Server start error: \(error)")
  21. }
  22. return true
  23. }
  24. }