Przeglądaj źródła

Use NSRunLoop rather than spin on OS X

John Holdsworth 11 lat temu
rodzic
commit
5da39449eb
2 zmienionych plików z 2 dodań i 2 usunięć
  1. 1 1
      Swifter/ViewController.swift
  2. 1 1
      SwifterOSX/main.swift

+ 1 - 1
Swifter/ViewController.swift

@@ -16,7 +16,7 @@ class ViewController: UIViewController {
         self.server = server
         self.server = server
         var error: NSError?
         var error: NSError?
         if !server.start(error: &error) {
         if !server.start(error: &error) {
-            println("Server start error: \(error)")
+            print("Server start error: \(error)")
         }
         }
     }
     }
 
 

+ 1 - 1
SwifterOSX/main.swift

@@ -14,7 +14,7 @@ if !server.start(9080, error: &error) {
     print("Server start error: \(error)")
     print("Server start error: \(error)")
 } else {
 } else {
     print("Server started. Try a connection now...")
     print("Server started. Try a connection now...")
-    while ( true ) { };
+    NSRunLoop.mainRunLoop().run()
 }
 }