Browse Source

Removed Active Record. It should be moved to separated repo.
Updated iOS demo app by adding "server stop" button.

Damian Kołakowski 11 năm trước cách đây
mục cha
commit
40b7a78611

+ 0 - 5
Common/ActiveRecord/Swifter-Bridging-Header.h

@@ -1,5 +0,0 @@
-//
-//  Use this file to import your target's public headers that you would like to expose to Swift.
-//
-
-#import <sqlite3.h>

+ 0 - 49
Common/ActiveRecord/SwifterActiveRecord.swift

@@ -1,49 +0,0 @@
-//
-//  ActiveRecord.swift
-//  Swifter
-//  Copyright (c) 2014 Damian Kołakowski. All rights reserved.
-//
-
-import Foundation
-
-struct SwifterActiveRecordField {
-    let name: String?
-    init(name: String?) {
-        self.name = name ?? "unknonw"
-    }
-}
-
-protocol WithInit {
-    init()
-}
-
-class SwifterActiveRecord<T: WithInit> {
-    
-    init() {
-
-    }
-    
-    private func scheme(error: NSErrorPointer?) -> [SwifterActiveRecordField] {
-        var results = [SwifterActiveRecordField]()
-        let classInfoDump = reflect(T())
-        for var index = 1; index < classInfoDump.count; ++index {
-            let field = classInfoDump[index]
-            results.append(SwifterActiveRecordField(name: field.0))
-        }
-        return results
-    }
-    
-    class func find(T -> Bool) -> [T] {
-        return []
-    }
-    
-    class func all() -> Array<String> {
-        return []
-    }
-    
-    func commit(error: NSErrorPointer) -> Bool {
-        return false
-    }
-}
-
-

+ 0 - 26
Common/ActiveRecord/SwifterDatabaseProxy.swift

@@ -1,26 +0,0 @@
-//
-//  ActiveRecordProxy.swift
-//  Swifter
-//  Copyright (c) 2014 Damian Kołakowski. All rights reserved.
-//
-
-import Foundation
-
-enum SwifterDatabseProxyType {
-    case String, Integer, Float, Unknown
-}
-
-protocol SwifterDatabseProxy {
-    func scheme(error: NSErrorPointer?) -> [String: [(String, String)]]?;
-    
-    func createTable(name: String, columns: [String: String], error: NSErrorPointer?) -> Bool;
-    func deleteTable(name: String, error: NSErrorPointer?) -> Bool;
-    
-    func insertColumn(table: String, column: String, error: NSErrorPointer?) -> Bool;
-    func deleteColumn(table: String, column: String, error: NSErrorPointer?) -> Bool;
-    
-    func copyColumn(table: String, from: String, to: String, error: NSErrorPointer?) -> Bool;
-    
-    func insertRow(table: String, value: [String: String], error: NSErrorPointer?) -> Int;
-    func deleteRow(table: String, id: Int, error: NSErrorPointer?) -> Bool;
-}

+ 0 - 5
Common/ActiveRecord/SwifterOSX-Bridging-Header.h

@@ -1,5 +0,0 @@
-//
-//  Use this file to import your target's public headers that you would like to expose to Swift.
-//
-
-#import <sqlite3.h>

+ 0 - 147
Common/ActiveRecord/SwifterSQLiteDatabaseProxy.swift

@@ -1,147 +0,0 @@
-//
-//  SQLiteProxy.swift
-//  Swifter
-//  Copyright (c) 2014 Damian Kołakowski. All rights reserved.
-//
-
-import Foundation
-
-class SQLiteSequenceElement {
-    
-    let statementPointer: COpaquePointer
-    
-    init(pointer: COpaquePointer) {
-        self.statementPointer = pointer
-    }
-    
-    func string(column: Int32) -> String {
-        if let value = String.fromCString(UnsafePointer<CChar>(sqlite3_column_text(statementPointer, column))) {
-            return value
-        }
-        /// Should never happend :)
-        /// From 'String.fromCString' documentation:
-        /// Returns `nil` if the `CString` is `NULL` or if it contains ill-formed
-        /// UTF-8 code unit sequences.
-        return "????"
-    }
-    
-    func integer(column: Int32) -> Int32 {
-        return sqlite3_column_int(statementPointer, column)
-    }
-    
-    func double(column: Int32) -> Double {
-        return sqlite3_column_double(statementPointer, column)
-    }
-}
-
-class SQLiteSequenceGenarator: GeneratorType {
-    
-    let statementPointer: COpaquePointer
-    
-    init(pointer: COpaquePointer) {
-        self.statementPointer = pointer
-    }
-    
-    func next() -> SQLiteSequenceElement? {
-        if ( sqlite3_step(statementPointer) == SQLITE_ROW ) {
-            return SQLiteSequenceElement(pointer: statementPointer)
-        }
-        sqlite3_finalize(statementPointer)
-        return nil
-    }
-}
-
-class SQLiteSequence: SequenceType {
-    
-    var statementPointer = COpaquePointer()
-    
-    init?(db: COpaquePointer, sql: String, err: NSErrorPointer? = nil) {
-        let result = sql.withCString { sqlite3_prepare(db, $0, Int32(strlen($0)), &self.statementPointer, nil) };
-        if result != SQLITE_OK {
-            if let err = err { err.memory = error("Can't prepare statement: \(sql), Error: \(result)") }
-            return nil
-        }
-    }
-    
-    func error(reason: String) -> NSError {
-        return NSError(domain: "SQLiteSequence", code: 0, userInfo: [NSLocalizedDescriptionKey : reason])
-    }
-    
-    func generate() -> SQLiteSequenceGenarator {
-        return SQLiteSequenceGenarator(pointer: statementPointer)
-    }
-}
-
-class SwifterSQLiteDatabaseProxy: SwifterDatabseProxy {
-
-    let name: String
-    
-    init(name databaseName: String) {
-        name = databaseName
-    }
-    
-    func err(reason: String) -> NSError {
-        return NSError(domain: "SwifterSQLiteDatabaseProxy", code: 0, userInfo: [NSLocalizedDescriptionKey : reason])
-    }
-    
-    func execute<Result>(name: String, sql: String, err: NSErrorPointer? = nil, f: ((SQLiteSequence) -> Result?)? = nil ) -> Result? {
-        var database = COpaquePointer()
-        if ( SQLITE_OK == name.withCString { sqlite3_open($0, &database) } ) {
-            if let sequence = SQLiteSequence(db: database, sql: sql, err: err) {
-                var result: Result?
-                if let f = f {
-                    result = f(sequence)
-                }
-                sqlite3_close(database)
-                return result
-            }
-            sqlite3_close(database)
-        }
-        return nil
-    }
-    
-    func scheme(error: NSErrorPointer?) -> [String: [(String, String)]]? {
-        let tables: [String]? = execute(name, sql: "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name;", err: error) { map($0, { $0.string(0) }) }
-        if let tables = tables {
-            var scheme = [String: [(String, String)]]()
-            for table in tables {
-                let columns: [(String, String)]? = execute(name, sql: "PRAGMA table_info('\(table)');", err: error) { map($0, { ($0.string(1), $0.string(2)) } ) }
-                if let columns = columns {
-                    scheme[table] = columns
-                } else {
-                    return nil
-                }
-            }
-            return scheme
-        }
-        return nil
-    }
-    
-    func createTable(name: String, columns: [String: String], error: NSErrorPointer?) -> Bool {
-        return false
-    }
-    
-    func deleteTable(name: String, error: NSErrorPointer?) -> Bool {
-        return false
-    }
-    
-    func insertColumn(table: String, column: String, error: NSErrorPointer?) -> Bool {
-        return false
-    }
-    
-    func deleteColumn(table: String, column: String, error: NSErrorPointer?) -> Bool {
-        return false
-    }
-    
-    func copyColumn(table: String, from: String, to: String, error: NSErrorPointer?) -> Bool {
-        return false
-    }
-    
-    func insertRow(table: String, value: [String: String], error: NSErrorPointer?) -> Int {
-        return 0
-    }
-    
-    func deleteRow(table: String, id: Int, error: NSErrorPointer?) -> Bool {
-        return false
-    }
-}

+ 2 - 2
Common/Socket.swift

@@ -18,7 +18,7 @@ struct Socket {
         return NSError(domain: "SOCKET", code: Int(errorCode), userInfo: nil)
     }
     
-    static func tcpForListen(port: in_port_t = 8080, error:NSErrorPointer = nil) -> CInt? {
+    static func tcpForListen(port: in_port_t = 8080, error: NSErrorPointer = nil) -> CInt? {
         let s = socket(AF_INET, SOCK_STREAM, 0)
         if ( s == -1 ) {
             if error != nil { error.memory = lastErr("socket(...) failed.") }
@@ -63,7 +63,7 @@ struct Socket {
         return true
     }
     
-    static func writeData(socket: CInt, data: NSData, error:NSErrorPointer = nil) -> Bool {
+    static func writeData(socket: CInt, data: NSData, error: NSErrorPointer = nil) -> Bool {
         var sent = 0
         let unsafePointer = UnsafePointer<UInt8>(data.bytes)
         while ( sent < data.length ) {

+ 4 - 42
Swifter.xcodeproj/project.pbxproj

@@ -7,20 +7,12 @@
 	objects = {
 
 /* Begin PBXBuildFile section */
-		7C6A510E1A149859004924B5 /* SwifterActiveRecord.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C6A510D1A149859004924B5 /* SwifterActiveRecord.swift */; };
-		7C6A510F1A149859004924B5 /* SwifterActiveRecord.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C6A510D1A149859004924B5 /* SwifterActiveRecord.swift */; };
 		7C71C5B01A1D52F800682BF0 /* login.html in CopyFiles */ = {isa = PBXBuildFile; fileRef = 98630C061A1C9A9D00478D08 /* login.html */; };
 		7C71C5B11A1EC49B00682BF0 /* logo.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = 7CB102DF1A17381D00CBA3B4 /* logo.png */; };
 		7C839B7419422CFF003A6950 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C839B7319422CFF003A6950 /* AppDelegate.swift */; };
 		7C839B7619422CFF003A6950 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C839B7519422CFF003A6950 /* ViewController.swift */; };
 		7C839B7919422CFF003A6950 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7C839B7719422CFF003A6950 /* Main.storyboard */; };
 		7C839B7B19422CFF003A6950 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7C839B7A19422CFF003A6950 /* Images.xcassets */; };
-		7C8B260C1A23878F00566475 /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 7C8B260B1A23878F00566475 /* libsqlite3.dylib */; };
-		7C8B260E1A23879500566475 /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 7C8B260D1A23879500566475 /* libsqlite3.dylib */; };
-		7C8B262B1A238E2F00566475 /* SwifterSQLiteDatabaseProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C8B262A1A238E2F00566475 /* SwifterSQLiteDatabaseProxy.swift */; };
-		7C8B262C1A238E2F00566475 /* SwifterSQLiteDatabaseProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C8B262A1A238E2F00566475 /* SwifterSQLiteDatabaseProxy.swift */; };
-		7C8B262E1A238E6F00566475 /* SwifterDatabaseProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C8B262D1A238E6F00566475 /* SwifterDatabaseProxy.swift */; };
-		7C8B262F1A238E6F00566475 /* SwifterDatabaseProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C8B262D1A238E6F00566475 /* SwifterDatabaseProxy.swift */; };
 		7CA4813E19A2EA8D0030B30D /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CA4813D19A2EA8D0030B30D /* main.swift */; };
 		7CA4814E19A2EED00030B30D /* HttpParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CA4814A19A2EED00030B30D /* HttpParser.swift */; };
 		7CA4814F19A2EED00030B30D /* HttpParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CA4814A19A2EED00030B30D /* HttpParser.swift */; };
@@ -58,19 +50,12 @@
 /* End PBXCopyFilesBuildPhase section */
 
 /* Begin PBXFileReference section */
-		7C6A510D1A149859004924B5 /* SwifterActiveRecord.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwifterActiveRecord.swift; sourceTree = "<group>"; };
 		7C839B6E19422CFF003A6950 /* Swifter.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Swifter.app; sourceTree = BUILT_PRODUCTS_DIR; };
 		7C839B7219422CFF003A6950 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
 		7C839B7319422CFF003A6950 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
 		7C839B7519422CFF003A6950 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
 		7C839B7819422CFF003A6950 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
 		7C839B7A19422CFF003A6950 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
-		7C8B260B1A23878F00566475 /* libsqlite3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = usr/lib/libsqlite3.dylib; sourceTree = SDKROOT; };
-		7C8B260D1A23879500566475 /* libsqlite3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/lib/libsqlite3.dylib; sourceTree = DEVELOPER_DIR; };
-		7C8B26241A238D4500566475 /* Swifter-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Swifter-Bridging-Header.h"; sourceTree = "<group>"; };
-		7C8B26251A238D4500566475 /* SwifterOSX-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SwifterOSX-Bridging-Header.h"; sourceTree = "<group>"; };
-		7C8B262A1A238E2F00566475 /* SwifterSQLiteDatabaseProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwifterSQLiteDatabaseProxy.swift; sourceTree = "<group>"; };
-		7C8B262D1A238E6F00566475 /* SwifterDatabaseProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwifterDatabaseProxy.swift; sourceTree = "<group>"; };
 		7CA4813B19A2EA8D0030B30D /* SwifterOSX */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = SwifterOSX; sourceTree = BUILT_PRODUCTS_DIR; };
 		7CA4813D19A2EA8D0030B30D /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
 		7CA4814A19A2EED00030B30D /* HttpParser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HttpParser.swift; sourceTree = "<group>"; };
@@ -90,7 +75,6 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				7C8B260C1A23878F00566475 /* libsqlite3.dylib in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -98,30 +82,15 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				7C8B260E1A23879500566475 /* libsqlite3.dylib in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
-		7C6A510C1A149843004924B5 /* ActiveRecord */ = {
-			isa = PBXGroup;
-			children = (
-				7C8B262A1A238E2F00566475 /* SwifterSQLiteDatabaseProxy.swift */,
-				7C8B262D1A238E6F00566475 /* SwifterDatabaseProxy.swift */,
-				7C6A510D1A149859004924B5 /* SwifterActiveRecord.swift */,
-				7C8B26241A238D4500566475 /* Swifter-Bridging-Header.h */,
-				7C8B26251A238D4500566475 /* SwifterOSX-Bridging-Header.h */,
-			);
-			path = ActiveRecord;
-			sourceTree = "<group>";
-		};
 		7C839B6519422CFF003A6950 = {
 			isa = PBXGroup;
 			children = (
-				7C8B260D1A23879500566475 /* libsqlite3.dylib */,
-				7C8B260B1A23878F00566475 /* libsqlite3.dylib */,
 				7CA4815619A2EF2B0030B30D /* Resources */,
 				7CA4814919A2EED00030B30D /* Common */,
 				7C839B7019422CFF003A6950 /* Swifter */,
@@ -170,7 +139,6 @@
 		7CA4814919A2EED00030B30D /* Common */ = {
 			isa = PBXGroup;
 			children = (
-				7C6A510C1A149843004924B5 /* ActiveRecord */,
 				7CA4815A19A2F6A60030B30D /* HttpRequest.swift */,
 				7CA4814A19A2EED00030B30D /* HttpParser.swift */,
 				7CA4814B19A2EED00030B30D /* HttpResponse.swift */,
@@ -285,15 +253,12 @@
 			isa = PBXSourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				7C6A510E1A149859004924B5 /* SwifterActiveRecord.swift in Sources */,
 				7CA4815019A2EED00030B30D /* HttpResponse.swift in Sources */,
 				7CB102DA1A1664B200CBA3B4 /* HttpHandlers.swift in Sources */,
 				7CB102DD1A167FFA00CBA3B4 /* DemoServer.swift in Sources */,
 				7C839B7619422CFF003A6950 /* ViewController.swift in Sources */,
 				7CA4815419A2EED00030B30D /* Socket.swift in Sources */,
 				7CA4815219A2EED00030B30D /* HttpServer.swift in Sources */,
-				7C8B262E1A238E6F00566475 /* SwifterDatabaseProxy.swift in Sources */,
-				7C8B262B1A238E2F00566475 /* SwifterSQLiteDatabaseProxy.swift in Sources */,
 				7CA4814E19A2EED00030B30D /* HttpParser.swift in Sources */,
 				7CA4815B19A2F6A60030B30D /* HttpRequest.swift in Sources */,
 				7C839B7419422CFF003A6950 /* AppDelegate.swift in Sources */,
@@ -308,12 +273,9 @@
 				7CB102DE1A1680EA00CBA3B4 /* DemoServer.swift in Sources */,
 				7CA4814F19A2EED00030B30D /* HttpParser.swift in Sources */,
 				7CA4815519A2EED00030B30D /* Socket.swift in Sources */,
-				7C8B262C1A238E2F00566475 /* SwifterSQLiteDatabaseProxy.swift in Sources */,
-				7C6A510F1A149859004924B5 /* SwifterActiveRecord.swift in Sources */,
 				7CA4815319A2EED00030B30D /* HttpServer.swift in Sources */,
 				7CA4813E19A2EA8D0030B30D /* main.swift in Sources */,
 				7CB102DB1A16657200CBA3B4 /* HttpHandlers.swift in Sources */,
-				7C8B262F1A238E6F00566475 /* SwifterDatabaseProxy.swift in Sources */,
 				7CA4815C19A2F6A60030B30D /* HttpRequest.swift in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
@@ -421,7 +383,7 @@
 				INFOPLIST_FILE = Swifter/Info.plist;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
 				PRODUCT_NAME = "$(TARGET_NAME)";
-				SWIFT_OBJC_BRIDGING_HEADER = "Common/ActiveRecord/Swifter-Bridging-Header.h";
+				SWIFT_OBJC_BRIDGING_HEADER = "";
 				SWIFT_OPTIMIZATION_LEVEL = "-Onone";
 			};
 			name = Debug;
@@ -435,7 +397,7 @@
 				INFOPLIST_FILE = Swifter/Info.plist;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
 				PRODUCT_NAME = "$(TARGET_NAME)";
-				SWIFT_OBJC_BRIDGING_HEADER = "Common/ActiveRecord/Swifter-Bridging-Header.h";
+				SWIFT_OBJC_BRIDGING_HEADER = "";
 			};
 			name = Release;
 		};
@@ -453,7 +415,7 @@
 				ONLY_ACTIVE_ARCH = YES;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SDKROOT = macosx;
-				SWIFT_OBJC_BRIDGING_HEADER = "Common/ActiveRecord/SwifterOSX-Bridging-Header.h";
+				SWIFT_OBJC_BRIDGING_HEADER = "";
 				SWIFT_OPTIMIZATION_LEVEL = "-Onone";
 			};
 			name = Debug;
@@ -468,7 +430,7 @@
 				MTL_ENABLE_DEBUG_INFO = NO;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SDKROOT = macosx;
-				SWIFT_OBJC_BRIDGING_HEADER = "Common/ActiveRecord/SwifterOSX-Bridging-Header.h";
+				SWIFT_OBJC_BRIDGING_HEADER = "";
 			};
 			name = Release;
 		};

BIN
Swifter.xcodeproj/project.xcworkspace/xcuserdata/damiankolakowski.xcuserdatad/UserInterfaceState.xcuserstate


+ 117 - 44
Swifter.xcodeproj/xcuserdata/damiankolakowski.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -136,6 +136,7 @@
                   continueAfterRunningActions = "No"
                   symbolName = "Swifter.HttpServer.subscript.getter (Swift.String) -&gt; Swift.Optional&lt;(Swift.String, Swift.Dictionary&lt;Swift.String, Swift.String&gt;) -&gt; Swifter.HttpResponse&gt;"
                   moduleName = "Swifter"
+                  usesParentBreakpointCondition = "Yes"
                   urlString = "file:///Users/damiankolakowski/Desktop/Swifter/Swifter/HttpServer.swift"
                   timestampString = "428450085.122215"
                   startingColumnNumber = "9223372036854775807"
@@ -150,6 +151,7 @@
                   continueAfterRunningActions = "No"
                   symbolName = "reabstraction thunk helper from @callee_owned (@in (Swift.String, Swift.Dictionary&lt;Swift.String, Swift.String&gt;)) -&gt; (@out Swifter.HttpResponse) to @callee_owned (@owned Swift.String, @owned Swift.Dictionary&lt;Swift.String, Swift.String&gt;) -&gt; (@owned Swifter.HttpResponse)"
                   moduleName = "Swifter"
+                  usesParentBreakpointCondition = "Yes"
                   urlString = "file:///Users/damiankolakowski/Desktop/Swifter/Swifter/HttpServer.swift"
                   timestampString = "428450085.12265"
                   startingColumnNumber = "9223372036854775807"
@@ -214,6 +216,7 @@
                   continueAfterRunningActions = "No"
                   symbolName = "SwifterOSX.HttpResponseBody.data (SwifterOSX.HttpResponseBody)() -&gt; Swift.Optional&lt;Swift.String&gt;"
                   moduleName = "SwifterOSX"
+                  usesParentBreakpointCondition = "Yes"
                   urlString = "file:///Users/damiankolakowski/Desktop/Swifter/Common/HttpResponse.swift"
                   timestampString = "430110038.833456"
                   startingColumnNumber = "9223372036854775807"
@@ -228,6 +231,7 @@
                   continueAfterRunningActions = "No"
                   symbolName = "SwifterOSX.HttpResponseBody.data (SwifterOSX.HttpResponseBody)() -&gt; Swift.Optional&lt;Swift.String&gt;"
                   moduleName = "SwifterOSX"
+                  usesParentBreakpointCondition = "Yes"
                   urlString = "file:///Users/damiankolakowski/Desktop/Swifter/Common/HttpResponse.swift"
                   timestampString = "430110038.833645"
                   startingColumnNumber = "9223372036854775807"
@@ -541,36 +545,6 @@
             endingLineNumber = "14"
             landmarkName = "directory(_:)"
             landmarkType = "5">
-            <Locations>
-               <Location
-                  shouldBeEnabled = "No"
-                  ignoreCount = "0"
-                  continueAfterRunningActions = "No"
-                  symbolName = "SwifterOSX.HttpHandlers.directory (SwifterOSX.HttpHandlers.Type)(Swift.String) -&gt; (SwifterOSX.HttpRequest) -&gt; SwifterOSX.HttpResponse"
-                  moduleName = "SwifterOSX"
-                  urlString = "file:///Users/damiankolakowski/Desktop/swifter/Common/HttpHandlers.swift"
-                  timestampString = "438224155.861229"
-                  startingColumnNumber = "9223372036854775807"
-                  endingColumnNumber = "9223372036854775807"
-                  startingLineNumber = "14"
-                  endingLineNumber = "14"
-                  offsetFromSymbolStart = "122">
-               </Location>
-               <Location
-                  shouldBeEnabled = "No"
-                  ignoreCount = "0"
-                  continueAfterRunningActions = "No"
-                  symbolName = "SwifterOSX.HttpHandlers.(directory (SwifterOSX.HttpHandlers.Type) -&gt; (Swift.String) -&gt; (SwifterOSX.HttpRequest) -&gt; SwifterOSX.HttpResponse).(closure #1)"
-                  moduleName = "SwifterOSX"
-                  urlString = "file:///Users/damiankolakowski/Desktop/swifter/Common/HttpHandlers.swift"
-                  timestampString = "438224155.861392"
-                  startingColumnNumber = "9223372036854775807"
-                  endingColumnNumber = "9223372036854775807"
-                  startingLineNumber = "14"
-                  endingLineNumber = "14"
-                  offsetFromSymbolStart = "163">
-               </Location>
-            </Locations>
          </BreakpointContent>
       </BreakpointProxy>
       <BreakpointProxy
@@ -729,20 +703,6 @@
             endingLineNumber = "12">
          </BreakpointContent>
       </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "SwifterOSX/main.swift"
-            timestampString = "440014599.057613"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "18"
-            endingLineNumber = "18">
-         </BreakpointContent>
-      </BreakpointProxy>
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
@@ -780,6 +740,7 @@
                   continueAfterRunningActions = "No"
                   symbolName = "SwifterOSX.SQLiteSequence.init (SwifterOSX.SQLiteSequence.Type)(database : Swift.COpaquePointer, statment : Swift.String, error : Swift.Optional&lt;Swift.AutoreleasingUnsafeMutablePointer&lt;Swift.Optional&lt;ObjectiveC.NSError&gt;&gt;&gt;) -&gt; Swift.Optional&lt;SwifterOSX.SQLiteSequence&gt;"
                   moduleName = "SwifterOSX"
+                  usesParentBreakpointCondition = "Yes"
                   urlString = "file:///Users/damiankolakowski/Desktop/swifter/Common/ActiveRecord/SwifterSQLiteDatabaseProxy.swift"
                   timestampString = "439934307.229626"
                   startingColumnNumber = "9223372036854775807"
@@ -794,6 +755,7 @@
                   continueAfterRunningActions = "No"
                   symbolName = "SwifterOSX.SQLiteSequence.(init (SwifterOSX.SQLiteSequence.Type) -&gt; (database : Swift.COpaquePointer, statment : Swift.String, error : Swift.Optional&lt;Swift.AutoreleasingUnsafeMutablePointer&lt;Swift.Optional&lt;ObjectiveC.NSError&gt;&gt;&gt;) -&gt; Swift.Optional&lt;SwifterOSX.SQLiteSequence&gt;).(closure #1)"
                   moduleName = "SwifterOSX"
+                  usesParentBreakpointCondition = "Yes"
                   urlString = "file:///Users/damiankolakowski/Desktop/swifter/Common/ActiveRecord/SwifterSQLiteDatabaseProxy.swift"
                   timestampString = "439934307.229793"
                   startingColumnNumber = "9223372036854775807"
@@ -808,6 +770,7 @@
                   continueAfterRunningActions = "No"
                   symbolName = "reabstraction thunk helper from @callee_owned (@unowned Swift.UnsafePointer&lt;Swift.Int8&gt;) -&gt; (@unowned Swift.Int32) to @callee_owned (@unowned Swift.UnsafePointer&lt;Swift.Int8&gt;) -&gt; (@out Swift.Int32)"
                   moduleName = "SwifterOSX"
+                  usesParentBreakpointCondition = "Yes"
                   urlString = "file:///Users/damiankolakowski/Desktop/swifter/Common/ActiveRecord/SwifterSQLiteDatabaseProxy.swift"
                   timestampString = "439934307.229924"
                   startingColumnNumber = "9223372036854775807"
@@ -867,5 +830,115 @@
             landmarkType = "5">
          </BreakpointContent>
       </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "Common/HttpHandlers.swift"
+            timestampString = "448289808.826471"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "13"
+            endingLineNumber = "13"
+            landmarkName = "directory(_:)"
+            landmarkType = "5">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "Common/HttpHandlers.swift"
+            timestampString = "448289829.185053"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "25"
+            endingLineNumber = "25"
+            landmarkName = "directoryBrowser(_:)"
+            landmarkType = "5">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "Common/DemoServer.swift"
+            timestampString = "448798123.272156"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "64"
+            endingLineNumber = "64"
+            landmarkName = "demoServer(_:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "Common/HttpParser.swift"
+            timestampString = "448798148.791495"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "16"
+            endingLineNumber = "16"
+            landmarkName = "nextHttpRequest(_:error:)"
+            landmarkType = "5">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "Common/HttpParser.swift"
+            timestampString = "448798167.471669"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "27"
+            endingLineNumber = "27"
+            landmarkName = "nextHttpRequest(_:error:)"
+            landmarkType = "5">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "SwifterOSX/main.swift"
+            timestampString = "455528191.812153"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "9"
+            endingLineNumber = "9">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "Swifter/ViewController.swift"
+            timestampString = "455528244.369233"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "14"
+            endingLineNumber = "14"
+            landmarkName = "viewDidLoad()"
+            landmarkType = "5">
+         </BreakpointContent>
+      </BreakpointProxy>
    </Breakpoints>
 </Bucket>

+ 1 - 7
Swifter/AppDelegate.swift

@@ -13,13 +13,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
     var window: UIWindow?
     var server: HttpServer?
     
-    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool {
-        let server = demoServer(NSBundle.mainBundle().resourcePath)
-        self.server = server
-        var error: NSError?
-        if !server.start(error: &error) {
-            println("Server start error: \(error)")
-        }
+    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool {
         return true
     }
 }

+ 28 - 2
Swifter/Base.lproj/Main.storyboard

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6206.8" systemVersion="13E28" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="7702" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
     <dependencies>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7026.1"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7701"/>
     </dependencies>
     <scenes>
         <!--View Controller-->
@@ -15,7 +15,33 @@
                     <view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
                         <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <subviews>
+                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="MAP-74-h0L">
+                                <rect key="frame" x="259" y="285" width="82" height="30"/>
+                                <state key="normal" title="Stop Server">
+                                    <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
+                                </state>
+                                <connections>
+                                    <action selector="likedThis:" destination="BYZ-38-t0r" eventType="touchUpInside" id="bni-mB-FqT"/>
+                                </connections>
+                            </button>
+                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="yQl-Ci-dgA">
+                                <rect key="frame" x="272" y="303" width="46" height="30"/>
+                                <state key="normal" title="Button">
+                                    <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
+                                </state>
+                            </button>
+                        </subviews>
                         <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
+                        <constraints>
+                            <constraint firstAttribute="centerY" secondItem="MAP-74-h0L" secondAttribute="centerY" id="Fgf-8c-jVA"/>
+                            <constraint firstAttribute="centerX" secondItem="MAP-74-h0L" secondAttribute="centerX" id="YeI-B9-qO2"/>
+                        </constraints>
+                        <variation key="default">
+                            <mask key="subviews">
+                                <exclude reference="yQl-Ci-dgA"/>
+                            </mask>
+                        </variation>
                     </view>
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>

+ 14 - 2
Swifter/ViewController.swift

@@ -7,15 +7,27 @@
 import UIKit
 
 class ViewController: UIViewController {
-                            
+    
+    var server: HttpServer?
+    
     override func viewDidLoad() {
         super.viewDidLoad()
-        // Do any additional setup after loading the view, typically from a nib.
+        let server = demoServer(NSBundle.mainBundle().resourcePath)
+        self.server = server
+        var error: NSError?
+        if !server.start(error: &error) {
+            println("Server start error: \(error)")
+        }
     }
 
     override func didReceiveMemoryWarning() {
         super.didReceiveMemoryWarning()
         // Dispose of any resources that can be recreated.
     }
+    
+    @IBAction func likedThis(sender: UIButton) {
+        self.server?.stop();
+        self.server = nil;
+    }
 }
 

+ 1 - 8
SwifterOSX/main.swift

@@ -6,19 +6,12 @@
 
 import Foundation
 
-let DB = SwifterSQLiteDatabaseProxy(name: "sample.db")
 
 var error: NSError?
 
-let scheme = DB.scheme(&error)
-
-println(scheme)
-println(error)
-
 let server = demoServer(NSBundle.mainBundle().resourcePath)
 
-
-if !server.start(error: &error) {
+if !server.start(listenPort: 9080, error: &error) {
     println("Server start error: \(error)")
 } else {
     println("Server started !")