Explorar o código

Ready for XCode 8 Beta 6.

Damian Kołakowski %!s(int64=9) %!d(string=hai) anos
pai
achega
ffba4535be
Modificáronse 32 ficheiros con 354 adicións e 462 borrados
  1. 0 20
      Sources/Swifter/Errno.swift
  2. 2 2
      Sources/Swifter/File.swift
  3. 12 12
      Sources/Swifter/HttpResponse.swift
  4. 56 173
      Sources/Swifter/JSON.swift
  5. 5 1
      Sources/Swifter/Process.swift
  6. 13 13
      Sources/Swifter/Reflection.swift
  7. 2 2
      Sources/Swifter/SQLite.swift
  8. 3 3
      Sources/Swifter/Scopes.swift
  9. 1 1
      Sources/Swifter/Socket+File.swift
  10. 12 12
      Sources/Swifter/Socket+Server.swift
  11. 14 14
      Sources/Swifter/Socket.swift
  12. 6 17
      Sources/TLS/BigNum.swift
  13. 2 2
      Sources/TLS/DER.swift
  14. 3 2
      Sources/TLS/HMAC.swift
  15. 5 5
      Sources/TLS/MD5.swift
  16. 5 5
      Sources/TLS/SHA1.swift
  17. 5 5
      Sources/TLS/SHA256.swift
  18. 4 4
      Sources/TLS/Socket+TLS.swift
  19. 138 58
      XCode/Swifter.xcodeproj/project.pbxproj
  20. 2 1
      XCode/SwifterSampleOSX/main.swift
  21. 16 17
      XCode/SwifterTestsCommon/SwifterTestsAES128.swift
  22. 0 1
      XCode/SwifterTestsCommon/SwifterTestsBigNum.swift
  23. 0 1
      XCode/SwifterTestsCommon/SwifterTestsHMAC.swift
  24. 6 7
      XCode/SwifterTestsCommon/SwifterTestsHttpParser.swift
  25. 28 29
      XCode/SwifterTestsCommon/SwifterTestsHttpRouter.swift
  26. 9 44
      XCode/SwifterTestsCommon/SwifterTestsJSON.swift
  27. 2 3
      XCode/SwifterTestsCommon/SwifterTestsRC4.swift
  28. 0 1
      XCode/SwifterTestsCommon/SwifterTestsRSA.swift
  29. 1 2
      XCode/SwifterTestsCommon/SwifterTestsReflection.swift
  30. 2 3
      XCode/SwifterTestsCommon/SwifterTestsSQLite.swift
  31. 0 1
      XCode/SwifterTestsCommon/SwifterTestsStringExtensions.swift
  32. 0 1
      XCode/SwifterTestsCommon/SwifterTestsWebSocketSession.swift

+ 0 - 20
Sources/Swifter/Errno.swift

@@ -1,20 +0,0 @@
-//
-//  Errno.swift
-//  Swifter
-//
-//  Copyright © 2016 Damian Kołakowski. All rights reserved.
-//
-
-#if os(Linux)
-    import Glibc
-#else
-    import Foundation
-#endif
-
-
-public struct Errno {
-    
-    public static var description: String {
-        return String(cString: UnsafePointer(strerror(errno))) ?? "Error: \(errno)"
-    }
-}

+ 2 - 2
Sources/Swifter/File.swift

@@ -76,7 +76,7 @@ public class File {
                 break
             }
             var name = ent.pointee.d_name
-            let fileName = withUnsafePointer(&name) { (ptr) -> String? in
+            let fileName = withUnsafePointer(to: &name) { (ptr) -> String? in
                 #if os(Linux)
                     return String.fromCString([CChar](UnsafeBufferPointer<CChar>(start: UnsafePointer(unsafeBitCast(ptr, UnsafePointer<CChar>.self)), count: 256)))
                 #else
@@ -137,7 +137,7 @@ public class File {
     }
     
     private static func descriptionOfLastError() -> String {
-        return String(cString: UnsafePointer(strerror(errno))) ?? "Error: \(errno)"
+        return String(cString: UnsafePointer(strerror(errno)))
     }
 }
 

+ 12 - 12
Sources/Swifter/HttpResponse.swift

@@ -20,7 +20,7 @@ public protocol HttpResponseBodyWriter {
 
 public enum HttpResponseBody {
     
-    case json(AnyObject)
+    case json(Any?)
     case html(String)
     case text(String)
     case data([UInt8])
@@ -30,23 +30,23 @@ public enum HttpResponseBody {
         do {
             switch self {
             case .json(let object):
-                #if os(Linux)
-                    let data = [UInt8]("Not ready for Linux.".utf8)
+                switch object {
+                case let array as Array<Any?>:
+                    let data = [UInt8](array.asJson().utf8)
                     return (data.count, {
-                        $0.write(data)
+                        try $0.write(data)
                     })
-                #else
-                    guard JSONSerialization.isValidJSONObject(object) else {
-                        throw SerializationError.invalidObject
-                    }
-                    let json = try JSONSerialization.data(withJSONObject: object, options: JSONSerialization.WritingOptions.prettyPrinted)
-                    let data = json.withUnsafeBytes({ (body: UnsafePointer<UInt8>) -> Array<UInt8> in
-                        return Array(UnsafeBufferPointer(start: body, count: json.count))
+                case let dict as Dictionary<String, Any?>:
+                    let data = [UInt8](dict.asJson().utf8)
+                    return (data.count, {
+                        try $0.write(data)
                     })
+                default:
+                    let data = [UInt8]("Serialisation error: Can't convert \(object) to JSON.".utf8)
                     return (data.count, {
                         try $0.write(data)
                     })
-                #endif
+                }
             case .text(let body):
                 let data = [UInt8](body.utf8)
                 return (data.count, {

+ 56 - 173
Sources/Swifter/JSON.swift

@@ -11,189 +11,72 @@
     import Foundation
 #endif
 
-// TODO 
-//  - Fix NSNumber extension decoding procedure.
-//  - Escape key string.
-
-public protocol JsonConvertable {
+extension Dictionary {
     
-    func asJson(_ ident: UInt?) -> String
-}
-
-extension String: JsonConvertable {
-    
-    public func asJson(_ ident: UInt? = 0) -> String {
-        return self.unicodeScalars.reduce("\"") { (c, s) -> String in
-            switch s.value {
-            case 0 : return c + "\\0"
-            case 7 : return c + "\\a"
-            case 8 : return c + "\\b"
-            case 9 : return c + "\\t"
-            case 10: return c + "\\n"
-            case 11: return c + "\\v"
-            case 12: return c + "\\f"
-            case 13: return c + "\\r"
-            case 34: return c + "\\\""
-            case 39: return c + "\\'"
-            case 47: return c + "\\/"
-            case 92: return c + "\\\\"
-            case let n where n > 127: return c + "\\u" + String(format:"%04X", n)
-            default:
-                return c + String(s)
+    public func asJson() -> String {
+        var tokens = [String]()
+        for (key, value) in self {
+            if let stringKey = key as? String {
+                tokens.append(escapeString(stringKey) + ":" + toJsonValue(value))
             }
-        } + "\""
-    }
-}
-
-extension Bool: JsonConvertable {
-    
-    public func asJson(_ ident: UInt?) -> String {
-        return self ? "true" : "false"
-    }
-}
-
-extension Double: JsonConvertable {
-    
-    public func asJson(_ ident: UInt?) -> String {
-        return String(self)
-    }
-}
-
-extension Float: JsonConvertable {
-    
-    public func asJson(_ ident: UInt?) -> String {
-        return String(self)
-    }
-}
-
-extension Int: JsonConvertable {
-    
-    public func asJson(_ ident: UInt?) -> String {
-        return String(self)
-    }
-}
-
-extension UInt: JsonConvertable {
-    
-    public func asJson(_ ident: UInt?) -> String {
-        return String(self)
-    }
-}
-
-extension Int8: JsonConvertable {
-    
-    public func asJson(_ ident: UInt?) -> String {
-        return String(self)
-    }
-}
-
-extension UInt8: JsonConvertable {
-    
-    public func asJson(_ ident: UInt?) -> String {
-        return String(self)
-    }
-}
-
-extension Int16: JsonConvertable {
-    
-    public func asJson(_ ident: UInt?) -> String {
-        return String(self)
-    }
-}
-
-extension UInt16: JsonConvertable {
-    
-    public func asJson(_ ident: UInt?) -> String {
-        return String(self)
-    }
-}
-
-extension Int32: JsonConvertable {
-    
-    public func asJson(_ ident: UInt?) -> String {
-        return String(self)
-    }
-}
-
-extension UInt32: JsonConvertable {
-    
-    public func asJson(_ ident: UInt?) -> String {
-        return String(self)
-    }
-}
-
-extension Int64: JsonConvertable {
-    
-    public func asJson(_ ident: UInt?) -> String {
-        return String(self)
-    }
-}
-
-extension UInt64: JsonConvertable {
-    
-    public func asJson(_ ident: UInt?) -> String {
-        return String(self)
-    }
-}
-
-extension Dictionary where Key: ExpressibleByStringLiteral, Value: JsonConvertable {
-    
-    public func asJson(_ ident: UInt?) -> String {
-        return "{" + self.map({ "\"\($0.0)\":" + $0.1.asJson(ident) }).joined(separator: ",") + "}"
-    }
-}
-
-extension Collection where Iterator.Element: JsonConvertable {
-    
-    public func asJson(_ ident: UInt?) -> String {
-        return "[" + (self.map({ $0.asJson(ident) }).joined(separator: ",")) + "]"
-    }
-}
-
-extension Array where Element: JsonConvertable {
-    
-    public func asJson(_ ident: UInt?) -> String {
-        return "[" + (self.map({ $0.asJson(ident) }).joined(separator: ",")) + "]"
-    }
-}
-
-extension NSString: JsonConvertable {
-    
-    public func asJson(_ ident: UInt?) -> String {
-        return (self as String).asJson(ident)
+        }
+        return "{" + tokens.joined(separator: ",") + "}"
     }
 }
 
-extension NSArray: JsonConvertable {
+extension Array {
     
-    public func asJson(_ ident: UInt?) -> String {
-        return "[" + (self.map({ ($0 as? JsonConvertable)?.asJson(ident) ?? "null" }).joined(separator: ",")) + "]"
+    public func asJson() -> String {
+        return "[" + self.map({ toJsonValue($0) }).joined(separator: ",") + "]"
     }
 }
 
-extension NSNumber: JsonConvertable {
-    
-    public func asJson(_ ident: UInt?) -> String {
-        switch String(cString: objCType) {
-            case "c":
-                if self == kCFBooleanTrue || self == kCFBooleanFalse {
-                    return self.boolValue.asJson(ident)
-                }
-                return self.int8Value.asJson(ident)
-            case "s": return self.int16Value.asJson(ident)
-            case "i": return self.int32Value.asJson(ident)
-            case "q": return self.int64Value.asJson(ident)
-            case "f": return self.floatValue.asJson(ident)
-            case "d": return self.doubleValue.asJson(ident)
+private func escapeString(_ string: String) -> String {
+    return string.unicodeScalars.reduce("\"") { (c, s) -> String in
+        switch s.value {
+        case 0 : return c + "\\0"
+        case 7 : return c + "\\a"
+        case 8 : return c + "\\b"
+        case 9 : return c + "\\t"
+        case 10: return c + "\\n"
+        case 11: return c + "\\v"
+        case 12: return c + "\\f"
+        case 13: return c + "\\r"
+        case 34: return c + "\\\""
+        case 39: return c + "\\'"
+        case 47: return c + "\\/"
+        case 92: return c + "\\\\"
+        case let n where n > 127: return c + "\\u" + String(format:"%04X", n)
         default:
-            return self.boolValue.asJson(ident)
+            return c + String(s)
+        }
+    } + "\""
+}
+
+private func toJsonValue(_ value: Any?) -> String {
+    if let value = value {
+        switch value {
+        case let int as Int8:   return String(int)
+        case let int as UInt8:  return String(int)
+        case let int as Int16:  return String(int)
+        case let int as UInt16: return String(int)
+        case let int as Int32: return String(int)
+        case let int as UInt32: return String(int)
+        case let int as Int64: return String(int)
+        case let int as UInt64: return String(int)
+        case let int as Int: return String(int)
+        case let int as UInt: return String(int)
+        case let int as Float: return String(int)
+        case let int as Double: return String(int)
+        case let bool as Bool: return bool ? "true" : "false"
+        case let dict as Dictionary<String, Any>: return dict.asJson()
+        case let dict as Dictionary<String, Any?>: return dict.asJson()
+        case let array as Array<Any>: return array.asJson()
+        case let array as Array<Any?>: return array.asJson()
+        case let string as String: return escapeString(string)
+        default:
+            return "null"
         }
     }
-}
-
-extension NSDictionary: JsonConvertable {
-    
-    public func asJson(_ ident: UInt?) -> String {
-        return "{" + self.map({ "\"\($0.0)\":" + (($0.1 as? JsonConvertable)?.asJson(ident) ?? "null") }).joined(separator: ",") + "}"
-    }
+    return "null"
 }

+ 5 - 1
Sources/Swifter/Process.swift

@@ -22,7 +22,7 @@ public class Process {
     private static var signalsWatchers = Array<(Int32) -> Void>()
     private static var signalsObserved = false
     
-    public static func watchSignals(_ callback: (Int32) -> Void) {
+    public static func watchSignals(_ callback: @escaping (Int32) -> Void) {
         if !signalsObserved {
             [SIGTERM, SIGHUP, SIGSTOP, SIGINT].forEach { item in
                 signal(item) {
@@ -33,4 +33,8 @@ public class Process {
         }
         signalsWatchers.append(callback)
     }
+    
+    public static var lastErrno: String {
+        return String(cString: UnsafePointer(strerror(errno)))
+    }
 }

+ 13 - 13
Sources/Swifter/Reflection.swift

@@ -91,19 +91,19 @@ public func memoryLayoutForStructure(_ object: Any) -> [String: CountableRange<I
     for case let (label?, value) in Mirror(reflecting: object).children {
         var fieldLength = 0
         // TODO - Replace this with something smarter.
-        if value is Int    { fieldLength = sizeof(Int.self)   } else
-        if value is UInt   { fieldLength = sizeof(UInt.self)  } else
-        if value is Int8   { fieldLength = sizeof(Int8.self)  } else
-        if value is UInt8  { fieldLength = sizeof(UInt8.self) } else
-        if value is Int16  { fieldLength = sizeof(Int16.self) } else
-        if value is UInt16 { fieldLength = sizeof(UInt16.self)} else
-        if value is Int32  { fieldLength = sizeof(Int32.self) } else
-        if value is UInt32 { fieldLength = sizeof(UInt32.self)} else
-        if value is Int64  { fieldLength = sizeof(Int64.self) } else
-        if value is UInt64 { fieldLength = sizeof(UInt64.self)} else
-        if value is Float  { fieldLength = sizeof(Float.self) } else
-        if value is Double { fieldLength = sizeof(Double.self)} else
-        if value is String { fieldLength = sizeof(String.self)}
+        if value is Int    { fieldLength = MemoryLayout<Int>.size   } else
+        if value is UInt   { fieldLength = MemoryLayout<UInt>.size  } else
+        if value is Int8   { fieldLength = MemoryLayout<Int8>.size  } else
+        if value is UInt8  { fieldLength = MemoryLayout<UInt8>.size } else
+        if value is Int16  { fieldLength = MemoryLayout<Int16>.size } else
+        if value is UInt16 { fieldLength = MemoryLayout<UInt16>.size} else
+        if value is Int32  { fieldLength = MemoryLayout<Int32>.size } else
+        if value is UInt32 { fieldLength = MemoryLayout<UInt32>.size} else
+        if value is Int64  { fieldLength = MemoryLayout<Int64>.size } else
+        if value is UInt64 { fieldLength = MemoryLayout<UInt64>.size} else
+        if value is Float  { fieldLength = MemoryLayout<Float>.size } else
+        if value is Double { fieldLength = MemoryLayout<Double>.size} else
+        if value is String { fieldLength = MemoryLayout<String>.size}
         if fieldLength <= alignment {
             layout[label] = size ..< size + fieldLength
             size = size + fieldLength

+ 2 - 2
Sources/Swifter/SQLite.swift

@@ -62,7 +62,7 @@ public class SQLite {
                 for i in 0..<sqlite3_column_count(statement) {
                     let name = String(cString: UnsafePointer<CChar>(sqlite3_column_name(statement, i)))
                     if let pointer = sqlite3_column_text(statement, i) {
-                        content[name] = String(cString: UnsafePointer<CChar>(pointer))
+                        content[name] = String(cString: UnsafePointer<CChar>(OpaquePointer(pointer)))
                     } else {
                         content[name] = nil
                     }
@@ -102,7 +102,7 @@ public class SQLite {
                 for i in 0..<sqlite3_column_count(statement) {
                     let name = String(cString: UnsafePointer<CChar>(sqlite3_column_name(statement, i)))
                     if let pointer = sqlite3_column_text(statement, i) {
-                        content[name] = String(cString: UnsafePointer<CChar>(pointer))
+                        content[name] = String(cString: UnsafePointer<CChar>(OpaquePointer(pointer)))
                     } else {
                         content[name] = nil
                     }

+ 3 - 3
Sources/Swifter/Scopes.swift

@@ -172,7 +172,7 @@ public func tr(_ c: Closure) { element("tr", c) }
 public func tt(_ c: Closure) { element("tt", c) }
 public func ul(_ c: Closure) { element("ul", c) }
 
-public func ul<T: Sequence>(_ collection: T, _ c: (T.Iterator.Element) -> Void) {
+public func ul<T: Sequence>(_ collection: T, _ c: @escaping (T.Iterator.Element) -> Void) {
     element("ul", {
         for item in collection {
             c(item)
@@ -245,7 +245,7 @@ public func small(_ c: Closure) { element("small", c) }
 public func style(_ c: Closure) { element("style", c) }
 public func table(_ c: Closure) { element("table", c) }
 
-public func table<T: Sequence>(_ collection: T, c: (T.Iterator.Element) -> Void) {
+public func table<T: Sequence>(_ collection: T, c: @escaping (T.Iterator.Element) -> Void) {
     element("table", {
         for item in collection {
             c(item)
@@ -255,7 +255,7 @@ public func table<T: Sequence>(_ collection: T, c: (T.Iterator.Element) -> Void)
 
 public func tbody(_ c: Closure) { element("tbody", c) }
 
-public func tbody<T: Sequence>(_ collection: T, c: (T.Iterator.Element) -> Void) {
+public func tbody<T: Sequence>(_ collection: T, c: @escaping (T.Iterator.Element) -> Void) {
     element("tbody", {
         for item in collection {
             c(item)

+ 1 - 1
Sources/Swifter/Socket+File.swift

@@ -46,7 +46,7 @@ extension Socket {
         var offset: off_t = 0
         let result = sendfileImpl(fileno(file.pointer), self.socketFileDescriptor, 0, &offset, nil, 0)
         if result == -1 {
-            throw SocketError.writeFailed("sendfile: " + Errno.description)
+            throw SocketError.writeFailed("sendfile: " + Process.lastErrno)
         }
     }
     

+ 12 - 12
Sources/Swifter/Socket+Server.swift

@@ -22,12 +22,12 @@ extension Socket {
         #endif
         
         if socketFileDescriptor == -1 {
-            throw SocketError.socketCreationFailed(Errno.description)
+            throw SocketError.socketCreationFailed(Process.lastErrno)
         }
         
         var value: Int32 = 1
-        if setsockopt(socketFileDescriptor, SOL_SOCKET, SO_REUSEADDR, &value, socklen_t(sizeof(Int32.self))) == -1 {
-            let details = Errno.description
+        if setsockopt(socketFileDescriptor, SOL_SOCKET, SO_REUSEADDR, &value, socklen_t(MemoryLayout<Int32>.size)) == -1 {
+            let details = Process.lastErrno
             Socket.release(socketFileDescriptor)
             throw SocketError.socketSettingReUseAddrFailed(details)
         }
@@ -58,37 +58,37 @@ extension Socket {
         #else
             var bindResult: Int32 = -1
             if forceIPv4 {
-                var addr = sockaddr_in(sin_len: UInt8(strideof(sockaddr_in.self)),
+                var addr = sockaddr_in(sin_len: UInt8(MemoryLayout<sockaddr_in>.stride),
                                        sin_family: UInt8(AF_INET),
                                        sin_port: port.bigEndian,
                                        sin_addr: in_addr(s_addr: in_addr_t(0)),
                                        sin_zero:(0, 0, 0, 0, 0, 0, 0, 0))
                 
-                bindResult = withUnsafePointer(&addr) {
-                    bind(socketFileDescriptor, UnsafePointer<sockaddr>($0), socklen_t(sizeof(sockaddr_in.self)))
+                bindResult = withUnsafePointer(to: &addr) {
+                    bind(socketFileDescriptor, UnsafePointer<sockaddr>(OpaquePointer($0)), socklen_t(MemoryLayout<sockaddr_in>.size))
                 }
             } else {
-                var addr = sockaddr_in6(sin6_len: UInt8(strideof(sockaddr_in6.self)),
+                var addr = sockaddr_in6(sin6_len: UInt8(MemoryLayout<sockaddr_in6>.stride),
                                         sin6_family: UInt8(AF_INET6),
                                         sin6_port: port.bigEndian,
                                         sin6_flowinfo: 0,
                                         sin6_addr: in6addr_any,
                                         sin6_scope_id: 0)
                 
-                bindResult = withUnsafePointer(&addr) {
-                    bind(socketFileDescriptor, UnsafePointer<sockaddr>($0), socklen_t(sizeof(sockaddr_in6.self)))
+                bindResult = withUnsafePointer(to: &addr) {
+                    bind(socketFileDescriptor, UnsafePointer<sockaddr>(OpaquePointer($0)), socklen_t(MemoryLayout<sockaddr_in6>.size))
                 }
             }
         #endif
         
         if bindResult == -1 {
-            let details = Errno.description
+            let details = Process.lastErrno
             Socket.release(socketFileDescriptor)
             throw SocketError.bindFailed(details)
         }
         
         if listen(socketFileDescriptor, maxPendingConnection) == -1 {
-            let details = Errno.description
+            let details = Process.lastErrno
             Socket.release(socketFileDescriptor)
             throw SocketError.listenFailed(details)
         }
@@ -100,7 +100,7 @@ extension Socket {
         var len: socklen_t = 0
         let clientSocket = accept(self.socketFileDescriptor, &addr, &len)
         if clientSocket == -1 {
-            throw SocketError.acceptFailed(Errno.description)
+            throw SocketError.acceptFailed(Process.lastErrno)
         }
         Socket.setNoSigPipe(clientSocket)
         return Socket(socketFileDescriptor: clientSocket)

+ 14 - 14
Sources/Swifter/Socket.swift

@@ -51,10 +51,10 @@ public class Socket: Hashable, Equatable {
     
     public func port() throws -> in_port_t {
         var addr = sockaddr_in()
-        return try withUnsafePointer(&addr) { pointer in
-            var len = socklen_t(sizeof(sockaddr_in.self))
-            if getsockname(socketFileDescriptor, UnsafeMutablePointer(pointer), &len) != 0 {
-                throw SocketError.getSockNameFailed(Errno.description)
+        return try withUnsafePointer(to: &addr) { pointer in
+            var len = socklen_t(MemoryLayout<sockaddr_in>.size)
+            if getsockname(socketFileDescriptor, UnsafeMutablePointer(OpaquePointer(pointer)), &len) != 0 {
+                throw SocketError.getSockNameFailed(Process.lastErrno)
             }
             #if os(Linux)
                 return ntohs(addr.sin_port)
@@ -66,10 +66,10 @@ public class Socket: Hashable, Equatable {
     
     public func isIPv4() throws -> Bool {
         var addr = sockaddr_in()
-        return try withUnsafePointer(&addr) { pointer in
-            var len = socklen_t(sizeof(sockaddr_in.self))
-            if getsockname(socketFileDescriptor, UnsafeMutablePointer(pointer), &len) != 0 {
-                throw SocketError.getSockNameFailed(Errno.description)
+        return try withUnsafePointer(to: &addr) { pointer in
+            var len = socklen_t(MemoryLayout<sockaddr_in>.size)
+            if getsockname(socketFileDescriptor, UnsafeMutablePointer(OpaquePointer(pointer)), &len) != 0 {
+                throw SocketError.getSockNameFailed(Process.lastErrno)
             }
             return Int32(addr.sin_family) == AF_INET
         }
@@ -96,7 +96,7 @@ public class Socket: Hashable, Equatable {
                     let s = write(self.socketFileDescriptor, baseAddress + sent, Int(data.count - sent))
                 #endif
                 if s <= 0 {
-                    throw SocketError.writeFailed(Errno.description)
+                    throw SocketError.writeFailed(Process.lastErrno)
                 }
                 sent += s
             }
@@ -107,7 +107,7 @@ public class Socket: Hashable, Equatable {
         var buffer = [UInt8](repeating: 0, count: 1)
         let next = recv(self.socketFileDescriptor as Int32, &buffer, Int(buffer.count), 0)
         if next <= 0 {
-            throw SocketError.recvFailed(Errno.description)
+            throw SocketError.recvFailed(Process.lastErrno)
         }
         return buffer[0]
     }
@@ -126,13 +126,13 @@ public class Socket: Hashable, Equatable {
     }
     
     public func peername() throws -> String {
-        var addr = sockaddr(), len: socklen_t = socklen_t(sizeof(sockaddr.self))
+        var addr = sockaddr(), len: socklen_t = socklen_t(MemoryLayout<sockaddr>.size)
         if getpeername(self.socketFileDescriptor, &addr, &len) != 0 {
-            throw SocketError.getPeerNameFailed(Errno.description)
+            throw SocketError.getPeerNameFailed(Process.lastErrno)
         }
         var hostBuffer = [CChar](repeating: 0, count: Int(NI_MAXHOST))
         if getnameinfo(&addr, len, &hostBuffer, socklen_t(hostBuffer.count), nil, 0, NI_NUMERICHOST) != 0 {
-            throw SocketError.getNameInfoFailed(Errno.description)
+            throw SocketError.getNameInfoFailed(Process.lastErrno)
         }
         return String(cString: hostBuffer)
     }
@@ -144,7 +144,7 @@ public class Socket: Hashable, Equatable {
         #else
             // Prevents crashes when blocking calls are pending and the app is paused ( via Home button ).
             var no_sig_pipe: Int32 = 1
-            setsockopt(socket, SOL_SOCKET, SO_NOSIGPIPE, &no_sig_pipe, socklen_t(sizeof(Int32.self)))
+            setsockopt(socket, SOL_SOCKET, SO_NOSIGPIPE, &no_sig_pipe, socklen_t(MemoryLayout<Int32>.size))
         #endif
     }
     

+ 6 - 17
Sources/TLS/BigNum.swift

@@ -37,7 +37,7 @@ public struct BigNum: Equatable, Comparable, CustomStringConvertible {
             return
         }
         
-        if text.unicodeScalars.count == 1 && text.unicodeScalars[text.unicodeScalars.startIndex].value == 48 {
+        if (text.unicodeScalars.count == 1) && (text.unicodeScalars[text.unicodeScalars.startIndex].value == 48) {
             self.signum = 0
             self.digits = [0]
             return
@@ -61,17 +61,14 @@ public struct BigNum: Equatable, Comparable, CustomStringConvertible {
     }
 }
 
-infix operator == { precedence 130 }
 public func == (_ left: BigNum, right: BigNum) -> Bool {
     return (left.digits == right.digits) && (left.signum == right.signum)
 }
 
-infix operator != { precedence 130 }
 public func != (_ left: BigNum, right: BigNum) -> Bool {
     return !(left.digits == right.digits)
 }
 
-infix operator + { associativity left precedence 140 }
 public func + (_ left: BigNum, _ right: BigNum) -> BigNum {
     
     if right.signum == 0 {
@@ -82,15 +79,15 @@ public func + (_ left: BigNum, _ right: BigNum) -> BigNum {
         return right
     }
     
-    if left.signum < 0 && right.signum < 0 {
+    if (left.signum < 0) && (right.signum < 0) {
         return BigNum((BigNum(left.digits, 1) + BigNum(right.digits, 1)).digits, -1)
     }
     
-    if left.signum > 0 && right.signum < 0 {
+    if (left.signum > 0) && (right.signum < 0) {
         return (left - BigNum(right.digits, 1))
     }
     
-    if left.signum < 0 && right.signum > 0 {
+    if (left.signum < 0) && (right.signum > 0) {
         return BigNum((right - BigNum(left.digits, 1)).digits, -1)
     }
     
@@ -116,7 +113,6 @@ public func + (_ left: BigNum, _ right: BigNum) -> BigNum {
     return result.isEmpty ? BigNum(result, 0) : BigNum(result, 1)
 }
 
-infix operator - { associativity left precedence 140 }
 public func - (_ left: BigNum, _ right: BigNum) -> BigNum {
     
     if right.signum == 0 {
@@ -135,7 +131,7 @@ public func - (_ left: BigNum, _ right: BigNum) -> BigNum {
         return BigNum((right - left).digits, -1)
     }
     
-    if left.signum < 0 && right.signum > 0 {
+    if (left.signum < 0) && (right.signum > 0) {
         return BigNum((BigNum(left.digits, 1) + right).digits, -1)
     }
     
@@ -158,7 +154,6 @@ public func - (_ left: BigNum, _ right: BigNum) -> BigNum {
     return result.isEmpty ? BigNum(result, 0) : BigNum(result, 1)
 }
 
-infix operator * { associativity left precedence 150 }
 public func * (_ left: BigNum, _ right: BigNum) -> BigNum {
     if (left.signum == 0) || (right.signum == 0) {
         return BigNum([], 0)
@@ -183,12 +178,11 @@ public func * (_ left: BigNum, _ right: BigNum) -> BigNum {
         }
         mulResults.append(row)
     }
-    var sum = mulResults.reduce(BigNum([0], 1)) { $0.partialResult + BigNum($0.1, 1) }
+    var sum = mulResults.reduce(BigNum([0], 1)) { $0.0 + BigNum($0.1, 1) }
     sum.signum = left.signum * right.signum
     return sum
 }
 
-infix operator / { associativity left precedence 150 }
 public func / (_ left: BigNum, _ right: BigNum) -> (quotient: BigNum, reminder: BigNum) {
     
     if left < right {
@@ -227,12 +221,10 @@ public func / (_ left: BigNum, _ right: BigNum) -> (quotient: BigNum, reminder:
     return (BigNum(quotient.reversed(), left.signum * right.signum), rest)
 }
 
-infix operator % { associativity left precedence 150 }
 public func % (_ left: BigNum, _ right: BigNum) -> BigNum {
     return (left / right).reminder
 }
 
-infix operator > { precedence 130 }
 public func > (_ left: BigNum, _ right: BigNum) -> Bool {
     if left.signum != right.signum {
         return left.signum > right.signum
@@ -256,7 +248,6 @@ public func > (_ left: BigNum, _ right: BigNum) -> Bool {
     return false
 }
 
-infix operator < { precedence 130 }
 public func < (_ left: BigNum, _ right: BigNum) -> Bool {
     if left.signum != right.signum {
         return left.signum < right.signum
@@ -280,12 +271,10 @@ public func < (_ left: BigNum, _ right: BigNum) -> Bool {
     return false
 }
 
-infix operator >= { precedence 130 }
 public func >= (_ left: BigNum, _ right: BigNum) -> Bool {
     return (left == right) || (left > right)
 }
 
-infix operator <= { precedence 130 }
 public func <= (_ left: BigNum, _ right: BigNum) -> Bool {
     return (left == right) || (left < right)
 }

+ 2 - 2
Sources/TLS/DER.swift

@@ -75,7 +75,7 @@ public struct DER {
                 throw DecodeError.invalidData
             }
             
-            return buffer.withUnsafeBufferPointer { UnsafePointer<UInt32>($0.baseAddress!).pointee.littleEndian }
+            return buffer.withUnsafeBufferPointer { UnsafePointer<UInt32>(OpaquePointer($0.baseAddress!)).pointee.littleEndian }
             
         default:
             
@@ -116,7 +116,7 @@ public struct DER {
                 }
                 
                 buffer = buffer.reversed() + /* padding */ [UInt8](repeating: 0, count: 4 - numberOfDigits)
-                let length = buffer.withUnsafeBufferPointer { UnsafePointer<UInt32>($0.baseAddress!).pointee.littleEndian }
+                let length = buffer.withUnsafeBufferPointer { UnsafePointer<UInt32>(OpaquePointer($0.baseAddress!)).pointee.littleEndian }
             
                 var content = [UInt8]()
                 for _ in 0..<length {

+ 3 - 2
Sources/TLS/HMAC.swift

@@ -44,10 +44,11 @@ public struct HMAC {
     }
     
     public static func md5(_ key: [UInt8], _ message: [UInt8]) -> String {
-        return md5(key, message).hex()
+        let digest: [UInt8] = md5(key, message)
+        return digest.hex()
     }
     
-    public static func generate(_ key: [UInt8], _ message: [UInt8], _ setup: (blockSize: Int, hash: (([UInt8]) -> [UInt8]))) -> [UInt8] {
+    public static func generate(_ key: [UInt8], _ message: [UInt8], _ setup: (blockSize: Int, hash: ([UInt8]) -> [UInt8])) -> [UInt8] {
         
         var paddedKey = key
         

+ 5 - 5
Sources/TLS/MD5.swift

@@ -29,8 +29,8 @@ public struct MD5 {
 
         var originalLengthInBits = UInt64(input.count * 8).littleEndian
         
-        withUnsafePointer(&originalLengthInBits) {
-            message.append(contentsOf: Array(UnsafeBufferPointer<UInt8>(start: UnsafePointer($0), count: 8)))
+        withUnsafePointer(to: &originalLengthInBits) {
+            message.append(contentsOf: Array(UnsafeBufferPointer<UInt8>(start: UnsafePointer(OpaquePointer($0)), count: 8)))
         }
         
         for chunkStart in 0..<message.count/64 {
@@ -39,7 +39,7 @@ public struct MD5 {
             
             for i in 0...15 {
                 words.append(chunk.withUnsafeBufferPointer {
-                    UnsafePointer<UInt32>($0.baseAddress! + (i*4)).pointee
+                    UnsafePointer<UInt32>(OpaquePointer($0.baseAddress! + (i*4))).pointee
                 })
             }
             
@@ -79,8 +79,8 @@ public struct MD5 {
         
         [a0, b0, c0, d0].forEach { value in
             var littleEndianVersion = value.littleEndian
-            withUnsafePointer(&littleEndianVersion) {
-                digest.append(contentsOf: Array(UnsafeBufferPointer<UInt8>(start: UnsafePointer($0), count: 4)))
+            withUnsafePointer(to: &littleEndianVersion) {
+                digest.append(contentsOf: Array(UnsafeBufferPointer<UInt8>(start: UnsafePointer(OpaquePointer($0)), count: 4)))
             }
         }
         

+ 5 - 5
Sources/TLS/SHA1.swift

@@ -43,8 +43,8 @@ public struct SHA1 {
         // append ml, in a 64-bit big-endian integer. Thus, the total length is a multiple of 512 bits.
         
         var mlBigEndian = ml.bigEndian
-        withUnsafePointer(&mlBigEndian) {
-            message.append(contentsOf: Array(UnsafeBufferPointer<UInt8>(start: UnsafePointer($0), count: 8)))
+        withUnsafePointer(to: &mlBigEndian) {
+            message.append(contentsOf: Array(UnsafeBufferPointer<UInt8>(start: UnsafePointer(OpaquePointer($0)), count: 8)))
         }
     
         // Process the message in successive 512-bit chunks ( 64 bytes chunks ):
@@ -56,7 +56,7 @@ public struct SHA1 {
             // break chunk into sixteen 32-bit big-endian words w[i], 0 ≤ i ≤ 15
             
             for i in 0...15 {
-                let value = chunk.withUnsafeBufferPointer({ UnsafePointer<UInt32>($0.baseAddress! + (i*4)).pointee})
+                let value = chunk.withUnsafeBufferPointer({ UnsafePointer<UInt32>(OpaquePointer($0.baseAddress! + (i*4))).pointee})
                 words.append(value.bigEndian)
             }
             
@@ -116,8 +116,8 @@ public struct SHA1 {
         
         [h0, h1, h2, h3, h4].forEach { value in
             var bigEndianVersion = value.bigEndian
-            withUnsafePointer(&bigEndianVersion) {
-                digest.append(contentsOf: Array(UnsafeBufferPointer<UInt8>(start: UnsafePointer($0), count: 4)))
+            withUnsafePointer(to: &bigEndianVersion) {
+                digest.append(contentsOf: Array(UnsafeBufferPointer<UInt8>(start: UnsafePointer(OpaquePointer($0)), count: 4)))
             }
         }
         

+ 5 - 5
Sources/TLS/SHA256.swift

@@ -47,8 +47,8 @@ public struct SHA256 {
         // append ml, in a 64-bit big-endian integer. Thus, the total length is a multiple of 512 bits.
         
         var mlBigEndian = ml.bigEndian
-        withUnsafePointer(&mlBigEndian) {
-            message.append(contentsOf: Array(UnsafeBufferPointer<UInt8>(start: UnsafePointer($0), count: 8)))
+        withUnsafePointer(to: &mlBigEndian) {
+            message.append(contentsOf: Array(UnsafeBufferPointer<UInt8>(start: UnsafePointer(OpaquePointer($0)), count: 8)))
         }
         
         // Process the message in successive 512-bit chunks ( 64 bytes chunks ):
@@ -60,7 +60,7 @@ public struct SHA256 {
             // Break chunk into sixteen 32-bit big-endian words w[i], 0 ≤ i ≤ 15
             
             for i in 0...15 {
-                let value = chunk.withUnsafeBufferPointer({ UnsafePointer<UInt32>($0.baseAddress! + (i*4)).pointee})
+                let value = chunk.withUnsafeBufferPointer({ UnsafePointer<UInt32>(OpaquePointer($0.baseAddress! + (i*4))).pointee})
                 words[i] = value.bigEndian
             }
         
@@ -122,8 +122,8 @@ public struct SHA256 {
         
         [h0, h1, h2, h3, h4, h5, h6, h7].forEach { value in
             var bigEndianVersion = value.bigEndian
-            withUnsafePointer(&bigEndianVersion) {
-                digest.append(contentsOf: Array(UnsafeBufferPointer<UInt8>(start: UnsafePointer($0), count: 4)))
+            withUnsafePointer(to: &bigEndianVersion) {
+                digest.append(contentsOf: Array(UnsafeBufferPointer<UInt8>(start: UnsafePointer(OpaquePointer($0)), count: 4)))
             }
         }
         

+ 4 - 4
Sources/TLS/Socket+TLS.swift

@@ -26,11 +26,11 @@ public func nextBytes(_ socket: Socket, _ n: Int) throws -> [UInt8] {
 }
 
 public func nextGeneric2<T: HasBigEndian>(_ socket: Socket) throws -> T {
-    return try nextBytes(socket, sizeof(T.self)).withUnsafeBufferPointer() { UnsafePointer<T>($0.baseAddress!).pointee }.bigEndian
+    return try nextBytes(socket, MemoryLayout<T>.size).withUnsafeBufferPointer() { UnsafePointer<T>(OpaquePointer($0.baseAddress!)).pointee }.bigEndian
 }
 
 public func nextUInt16(_ socket: Socket) throws -> UInt16 {
-    return try nextBytes(socket, sizeof(UInt16.self)).withUnsafeBufferPointer() { UnsafePointer<UInt16>($0.baseAddress!).pointee }.bigEndian
+    return try nextBytes(socket, MemoryLayout<UInt16>.size).withUnsafeBufferPointer() { UnsafePointer<UInt16>(OpaquePointer($0.baseAddress!)).pointee }.bigEndian
 }
 
 public struct DataIterator {
@@ -57,7 +57,7 @@ public struct DataIterator {
     }
     
     public mutating func nextUInt16() -> UInt16? {
-        return next(sizeof(UInt16.self))?.withUnsafeBufferPointer() { UnsafePointer<UInt16>($0.baseAddress!).pointee }.bigEndian
+        return next(MemoryLayout<UInt16>.size)?.withUnsafeBufferPointer() { UnsafePointer<UInt16>(OpaquePointer($0.baseAddress!)).pointee }.bigEndian
     }
 }
 
@@ -137,7 +137,7 @@ extension Socket {
         let length1 = try socket.read()
         let length0 = try socket.read()
         
-        let length = [length0, length1, length2, 0].withUnsafeBufferPointer() { UnsafePointer<UInt32>($0.baseAddress!).pointee }.littleEndian
+        let length = [length0, length1, length2, 0].withUnsafeBufferPointer() { UnsafePointer<UInt32>(OpaquePointer($0.baseAddress!)).pointee }.littleEndian
         
         while UInt32(handshake.message.count) < length { handshake.message.append(try socket.read()) }
         

+ 138 - 58
XCode/Swifter.xcodeproj/project.pbxproj

@@ -92,12 +92,69 @@
 		7C5F79071D5627EE00C514AA /* Socket+Server.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C5F79061D5627EE00C514AA /* Socket+Server.swift */; };
 		7C5F79081D5627EE00C514AA /* Socket+Server.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C5F79061D5627EE00C514AA /* Socket+Server.swift */; };
 		7C5F79091D5627EE00C514AA /* Socket+Server.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C5F79061D5627EE00C514AA /* Socket+Server.swift */; };
-		7C5F790B1D56281200C514AA /* Errno.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C5F790A1D56281200C514AA /* Errno.swift */; };
-		7C5F790C1D56281200C514AA /* Errno.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C5F790A1D56281200C514AA /* Errno.swift */; };
-		7C5F790D1D56281200C514AA /* Errno.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C5F790A1D56281200C514AA /* Errno.swift */; };
 		7C5F790F1D56287000C514AA /* Socket+File.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C5F790E1D56287000C514AA /* Socket+File.swift */; };
 		7C5F79101D56287000C514AA /* Socket+File.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C5F790E1D56287000C514AA /* Socket+File.swift */; };
 		7C5F79111D56287000C514AA /* Socket+File.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C5F790E1D56287000C514AA /* Socket+File.swift */; };
+		7C615E721D63BE7F0082E4BC /* App.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C3195E71CC2C68F00DF5406 /* App.swift */; };
+		7C615E731D63BE7F0082E4BC /* DemoServer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C3195E81CC2C68F00DF5406 /* DemoServer.swift */; };
+		7C615E741D63BE7F0082E4BC /* File.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C3195E91CC2C68F00DF5406 /* File.swift */; };
+		7C615E751D63BE7F0082E4BC /* Files.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C3195EA1CC2C68F00DF5406 /* Files.swift */; };
+		7C615E761D63BE7F0082E4BC /* Scopes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C3945631D256FDA003EEABA /* Scopes.swift */; };
+		7C615E771D63BE7F0082E4BC /* WebSockets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C3195EB1CC2C68F00DF5406 /* WebSockets.swift */; };
+		7C615E781D63BE7F0082E4BC /* HttpParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C3195ED1CC2C68F00DF5406 /* HttpParser.swift */; };
+		7C615E791D63BE7F0082E4BC /* HttpRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C3195EE1CC2C68F00DF5406 /* HttpRequest.swift */; };
+		7C615E7A1D63BE7F0082E4BC /* HttpResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C3195EF1CC2C68F00DF5406 /* HttpResponse.swift */; };
+		7C615E7B1D63BE7F0082E4BC /* HttpRouter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C3195F01CC2C68F00DF5406 /* HttpRouter.swift */; };
+		7C615E7C1D63BE7F0082E4BC /* HttpServer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C3195F11CC2C68F00DF5406 /* HttpServer.swift */; };
+		7C615E7D1D63BE7F0082E4BC /* HttpServerIO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C3195F21CC2C68F00DF5406 /* HttpServerIO.swift */; };
+		7C615E7E1D63BE7F0082E4BC /* Process.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C3195F31CC2C68F00DF5406 /* Process.swift */; };
+		7C615E7F1D63BE7F0082E4BC /* Reflection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C3195F41CC2C68F00DF5406 /* Reflection.swift */; };
+		7C615E801D63BE7F0082E4BC /* Socket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C3195F51CC2C68F00DF5406 /* Socket.swift */; };
+		7C615E811D63BE7F0082E4BC /* Socket+Server.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C5F79061D5627EE00C514AA /* Socket+Server.swift */; };
+		7C615E821D63BE7F0082E4BC /* Socket+File.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C5F790E1D56287000C514AA /* Socket+File.swift */; };
+		7C615E831D63BE7F0082E4BC /* SQLite.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C3195F71CC2C68F00DF5406 /* SQLite.swift */; };
+		7C615E841D63BE7F0082E4BC /* String+BASE64.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C3195F81CC2C68F00DF5406 /* String+BASE64.swift */; };
+		7C615E851D63BE7F0082E4BC /* String+Misc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C3195F91CC2C68F00DF5406 /* String+Misc.swift */; };
+		7C615E941D63BE810082E4BC /* App.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C3195E71CC2C68F00DF5406 /* App.swift */; };
+		7C615E951D63BE810082E4BC /* DemoServer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C3195E81CC2C68F00DF5406 /* DemoServer.swift */; };
+		7C615E961D63BE810082E4BC /* File.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C3195E91CC2C68F00DF5406 /* File.swift */; };
+		7C615E971D63BE810082E4BC /* Files.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C3195EA1CC2C68F00DF5406 /* Files.swift */; };
+		7C615E981D63BE810082E4BC /* Scopes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C3945631D256FDA003EEABA /* Scopes.swift */; };
+		7C615E991D63BE810082E4BC /* WebSockets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C3195EB1CC2C68F00DF5406 /* WebSockets.swift */; };
+		7C615E9A1D63BE810082E4BC /* HttpParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C3195ED1CC2C68F00DF5406 /* HttpParser.swift */; };
+		7C615E9B1D63BE810082E4BC /* HttpRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C3195EE1CC2C68F00DF5406 /* HttpRequest.swift */; };
+		7C615E9C1D63BE810082E4BC /* HttpResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C3195EF1CC2C68F00DF5406 /* HttpResponse.swift */; };
+		7C615E9D1D63BE810082E4BC /* HttpRouter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C3195F01CC2C68F00DF5406 /* HttpRouter.swift */; };
+		7C615E9E1D63BE810082E4BC /* HttpServer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C3195F11CC2C68F00DF5406 /* HttpServer.swift */; };
+		7C615E9F1D63BE810082E4BC /* HttpServerIO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C3195F21CC2C68F00DF5406 /* HttpServerIO.swift */; };
+		7C615EA01D63BE810082E4BC /* Process.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C3195F31CC2C68F00DF5406 /* Process.swift */; };
+		7C615EA11D63BE810082E4BC /* Reflection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C3195F41CC2C68F00DF5406 /* Reflection.swift */; };
+		7C615EA21D63BE810082E4BC /* Socket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C3195F51CC2C68F00DF5406 /* Socket.swift */; };
+		7C615EA31D63BE810082E4BC /* Socket+Server.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C5F79061D5627EE00C514AA /* Socket+Server.swift */; };
+		7C615EA41D63BE810082E4BC /* Socket+File.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C5F790E1D56287000C514AA /* Socket+File.swift */; };
+		7C615EA51D63BE810082E4BC /* SQLite.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C3195F71CC2C68F00DF5406 /* SQLite.swift */; };
+		7C615EA61D63BE810082E4BC /* String+BASE64.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C3195F81CC2C68F00DF5406 /* String+BASE64.swift */; };
+		7C615EA71D63BE810082E4BC /* String+Misc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C3195F91CC2C68F00DF5406 /* String+Misc.swift */; };
+		7C615EA91D63BE8D0082E4BC /* AES128.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26DD1D5CD64600666F69 /* AES128.swift */; };
+		7C615EAA1D63BE8D0082E4BC /* BigNum.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26DE1D5CD64600666F69 /* BigNum.swift */; };
+		7C615EAB1D63BE8D0082E4BC /* HMAC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26DF1D5CD64600666F69 /* HMAC.swift */; };
+		7C615EAC1D63BE8D0082E4BC /* MD5.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26E01D5CD64600666F69 /* MD5.swift */; };
+		7C615EAD1D63BE8D0082E4BC /* RC4.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26E11D5CD64600666F69 /* RC4.swift */; };
+		7C615EAE1D63BE8D0082E4BC /* RSA.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26E21D5CD64600666F69 /* RSA.swift */; };
+		7C615EAF1D63BE8D0082E4BC /* SHA1.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26E31D5CD64600666F69 /* SHA1.swift */; };
+		7C615EB11D63BE8D0082E4BC /* SHA256.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CFEA3531D5DFDA9009A9BF7 /* SHA256.swift */; };
+		7C615EB21D63BE8D0082E4BC /* Socket+TLS.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C5CFD911D5E353D001E1016 /* Socket+TLS.swift */; };
+		7C615EB31D63BE8D0082E4BC /* DER.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CECB5921D5F27040039A704 /* DER.swift */; };
+		7C615EB41D63BE8E0082E4BC /* AES128.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26DD1D5CD64600666F69 /* AES128.swift */; };
+		7C615EB51D63BE8E0082E4BC /* BigNum.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26DE1D5CD64600666F69 /* BigNum.swift */; };
+		7C615EB61D63BE8E0082E4BC /* HMAC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26DF1D5CD64600666F69 /* HMAC.swift */; };
+		7C615EB71D63BE8E0082E4BC /* MD5.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26E01D5CD64600666F69 /* MD5.swift */; };
+		7C615EB81D63BE8E0082E4BC /* RC4.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26E11D5CD64600666F69 /* RC4.swift */; };
+		7C615EB91D63BE8E0082E4BC /* RSA.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26E21D5CD64600666F69 /* RSA.swift */; };
+		7C615EBA1D63BE8E0082E4BC /* SHA1.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26E31D5CD64600666F69 /* SHA1.swift */; };
+		7C615EBC1D63BE8E0082E4BC /* SHA256.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CFEA3531D5DFDA9009A9BF7 /* SHA256.swift */; };
+		7C615EBD1D63BE8E0082E4BC /* Socket+TLS.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C5CFD911D5E353D001E1016 /* Socket+TLS.swift */; };
+		7C615EBE1D63BE8E0082E4BC /* DER.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CECB5921D5F27040039A704 /* DER.swift */; };
 		7C6B57EB1CA6C3AA0042655C /* SwifterTestsHttpRouter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C6B57EA1CA6C3AA0042655C /* SwifterTestsHttpRouter.swift */; };
 		7C6B57EC1CA6C3AA0042655C /* SwifterTestsHttpRouter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C6B57EA1CA6C3AA0042655C /* SwifterTestsHttpRouter.swift */; };
 		7C71C5B01A1D52F800682BF0 /* login.html in CopyFiles */ = {isa = PBXBuildFile; fileRef = 98630C061A1C9A9D00478D08 /* login.html */; };
@@ -110,9 +167,6 @@
 		7CA4815819A2EF2B0030B30D /* test.json in Resources */ = {isa = PBXBuildFile; fileRef = 7CA4815719A2EF2B0030B30D /* test.json */; };
 		7CA4815919A2EF560030B30D /* test.json in CopyFiles */ = {isa = PBXBuildFile; fileRef = 7CA4815719A2EF2B0030B30D /* test.json */; };
 		7CB102E01A17381D00CBA3B4 /* logo.png in Resources */ = {isa = PBXBuildFile; fileRef = 7CB102DF1A17381D00CBA3B4 /* logo.png */; };
-		7CB923CC1D50F11700899E2A /* JSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C2C85901D50D83D00B32145 /* JSON.swift */; };
-		7CB923CD1D50F11800899E2A /* JSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C2C85901D50D83D00B32145 /* JSON.swift */; };
-		7CB923CE1D50F11800899E2A /* JSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C2C85901D50D83D00B32145 /* JSON.swift */; };
 		7CB923D01D510D6400899E2A /* SwifterTestsJSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CB923CF1D510D6400899E2A /* SwifterTestsJSON.swift */; };
 		7CB923D11D510D6400899E2A /* SwifterTestsJSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CB923CF1D510D6400899E2A /* SwifterTestsJSON.swift */; };
 		7CCD1B681C8F7CEC0016D664 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CCD1B671C8F7CEC0016D664 /* AppDelegate.swift */; };
@@ -124,45 +178,45 @@
 		7CCD1BA11C8F82B60016D664 /* logo.png in Resources */ = {isa = PBXBuildFile; fileRef = 7CB102DF1A17381D00CBA3B4 /* logo.png */; };
 		7CCD1BA21C8F82B60016D664 /* test.json in Resources */ = {isa = PBXBuildFile; fileRef = 7CA4815719A2EF2B0030B30D /* test.json */; };
 		7CCD1BBE1C8F84E60016D664 /* SwifteriOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AE893E91C05127900A29F63 /* SwifteriOS.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		7CCD87611C66099B0068099B /* Swifter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7AE893E71C05127900A29F63 /* Swifter.framework */; };
 		7CCD87701C660B250068099B /* SwifterTestsHttpParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CCD876D1C660B250068099B /* SwifterTestsHttpParser.swift */; };
 		7CCD87721C660B250068099B /* SwifterTestsStringExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CCD876E1C660B250068099B /* SwifterTestsStringExtensions.swift */; };
-		7CCD877E1C660EA30068099B /* Swifter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7AE893FB1C0512C400A29F63 /* Swifter.framework */; };
 		7CCD87841C660ED60068099B /* SwifterTestsHttpParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CCD876D1C660B250068099B /* SwifterTestsHttpParser.swift */; };
 		7CCD87851C660ED60068099B /* SwifterTestsStringExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CCD876E1C660B250068099B /* SwifterTestsStringExtensions.swift */; };
 		7CDAB8131BE2A1D400C8A977 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7CDAB80D1BE2A1D400C8A977 /* Main.storyboard */; };
 		7CDAB8141BE2A1D400C8A977 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7CDAB80F1BE2A1D400C8A977 /* Images.xcassets */; };
 		7CDAB8161BE2A1D400C8A977 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDAB8111BE2A1D400C8A977 /* ViewController.swift */; };
-		7CDF26E41D5CD64600666F69 /* AES128.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26DD1D5CD64600666F69 /* AES128.swift */; };
 		7CDF26E51D5CD64600666F69 /* AES128.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26DD1D5CD64600666F69 /* AES128.swift */; };
 		7CDF26E61D5CD64600666F69 /* AES128.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26DD1D5CD64600666F69 /* AES128.swift */; };
 		7CDF26E71D5CD64600666F69 /* AES128.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26DD1D5CD64600666F69 /* AES128.swift */; };
-		7CDF26E81D5CD64600666F69 /* BigNum.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26DE1D5CD64600666F69 /* BigNum.swift */; };
 		7CDF26E91D5CD64600666F69 /* BigNum.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26DE1D5CD64600666F69 /* BigNum.swift */; };
 		7CDF26EA1D5CD64600666F69 /* BigNum.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26DE1D5CD64600666F69 /* BigNum.swift */; };
 		7CDF26EB1D5CD64600666F69 /* BigNum.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26DE1D5CD64600666F69 /* BigNum.swift */; };
-		7CDF26EC1D5CD64600666F69 /* HMAC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26DF1D5CD64600666F69 /* HMAC.swift */; };
 		7CDF26ED1D5CD64600666F69 /* HMAC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26DF1D5CD64600666F69 /* HMAC.swift */; };
 		7CDF26EE1D5CD64600666F69 /* HMAC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26DF1D5CD64600666F69 /* HMAC.swift */; };
 		7CDF26EF1D5CD64600666F69 /* HMAC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26DF1D5CD64600666F69 /* HMAC.swift */; };
-		7CDF26F01D5CD64600666F69 /* MD5.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26E01D5CD64600666F69 /* MD5.swift */; };
 		7CDF26F11D5CD64600666F69 /* MD5.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26E01D5CD64600666F69 /* MD5.swift */; };
 		7CDF26F21D5CD64600666F69 /* MD5.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26E01D5CD64600666F69 /* MD5.swift */; };
 		7CDF26F31D5CD64600666F69 /* MD5.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26E01D5CD64600666F69 /* MD5.swift */; };
-		7CDF26F41D5CD64600666F69 /* RC4.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26E11D5CD64600666F69 /* RC4.swift */; };
 		7CDF26F51D5CD64600666F69 /* RC4.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26E11D5CD64600666F69 /* RC4.swift */; };
 		7CDF26F61D5CD64600666F69 /* RC4.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26E11D5CD64600666F69 /* RC4.swift */; };
 		7CDF26F71D5CD64600666F69 /* RC4.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26E11D5CD64600666F69 /* RC4.swift */; };
-		7CDF26F81D5CD64600666F69 /* RSA.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26E21D5CD64600666F69 /* RSA.swift */; };
 		7CDF26F91D5CD64600666F69 /* RSA.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26E21D5CD64600666F69 /* RSA.swift */; };
 		7CDF26FA1D5CD64600666F69 /* RSA.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26E21D5CD64600666F69 /* RSA.swift */; };
 		7CDF26FB1D5CD64600666F69 /* RSA.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26E21D5CD64600666F69 /* RSA.swift */; };
-		7CDF26FC1D5CD64600666F69 /* SHA1.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26E31D5CD64600666F69 /* SHA1.swift */; };
 		7CDF26FD1D5CD64600666F69 /* SHA1.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26E31D5CD64600666F69 /* SHA1.swift */; };
 		7CDF26FE1D5CD64600666F69 /* SHA1.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26E31D5CD64600666F69 /* SHA1.swift */; };
 		7CDF26FF1D5CD64600666F69 /* SHA1.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDF26E31D5CD64600666F69 /* SHA1.swift */; };
 		7CE0B9EF1D5BBAAD0070D292 /* SwifterTestsHMAC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CE0B9EE1D5BBAAD0070D292 /* SwifterTestsHMAC.swift */; };
 		7CE0B9F01D5BBAAD0070D292 /* SwifterTestsHMAC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CE0B9EE1D5BBAAD0070D292 /* SwifterTestsHMAC.swift */; };
+		7CE425E31D64A30800CCD71A /* JSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C2C85901D50D83D00B32145 /* JSON.swift */; };
+		7CE425E41D64A30800CCD71A /* JSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C2C85901D50D83D00B32145 /* JSON.swift */; };
+		7CE425E51D64A30800CCD71A /* JSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C2C85901D50D83D00B32145 /* JSON.swift */; };
+		7CE425E91D64A45A00CCD71A /* JSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C2C85901D50D83D00B32145 /* JSON.swift */; };
+		7CE425EA1D64A45B00CCD71A /* JSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C2C85901D50D83D00B32145 /* JSON.swift */; };
+		7CE425EB1D64A4F900CCD71A /* HEX.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C00AABD1D5D374700EDA547 /* HEX.swift */; };
+		7CE425EC1D64A4F900CCD71A /* HEX.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C00AABD1D5D374700EDA547 /* HEX.swift */; };
+		7CE425ED1D64A51B00CCD71A /* sqlite.c in Sources */ = {isa = PBXBuildFile; fileRef = 7C3195E51CC2C68F00DF5406 /* sqlite.c */; };
+		7CE425EE1D64A51B00CCD71A /* sqlite.c in Sources */ = {isa = PBXBuildFile; fileRef = 7C3195E51CC2C68F00DF5406 /* sqlite.c */; };
 		7CECB5931D5F27040039A704 /* DER.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CECB5921D5F27040039A704 /* DER.swift */; };
 		7CECB5941D5F27040039A704 /* DER.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CECB5921D5F27040039A704 /* DER.swift */; };
 		7CECB5951D5F27040039A704 /* DER.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CECB5921D5F27040039A704 /* DER.swift */; };
@@ -194,20 +248,6 @@
 			remoteGlobalIDString = 7CCD1BA81C8F84E60016D664;
 			remoteInfo = SwiftertvOS;
 		};
-		7CCD87621C66099B0068099B /* PBXContainerItemProxy */ = {
-			isa = PBXContainerItemProxy;
-			containerPortal = 7C839B6619422CFF003A6950 /* Project object */;
-			proxyType = 1;
-			remoteGlobalIDString = 7AE893E61C05127900A29F63;
-			remoteInfo = SwifteriOS;
-		};
-		7CCD877F1C660EA30068099B /* PBXContainerItemProxy */ = {
-			isa = PBXContainerItemProxy;
-			containerPortal = 7C839B6619422CFF003A6950 /* Project object */;
-			proxyType = 1;
-			remoteGlobalIDString = 7AE893FA1C0512C400A29F63;
-			remoteInfo = SwifterMac;
-		};
 /* End PBXContainerItemProxy section */
 
 /* Begin PBXCopyFilesBuildPhase section */
@@ -266,7 +306,6 @@
 		7C5F78F51D54D21600C514AA /* SwifterTestsRC4.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwifterTestsRC4.swift; sourceTree = "<group>"; };
 		7C5F79031D55F44500C514AA /* SwifterTestsRSA.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwifterTestsRSA.swift; sourceTree = "<group>"; };
 		7C5F79061D5627EE00C514AA /* Socket+Server.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Socket+Server.swift"; sourceTree = "<group>"; };
-		7C5F790A1D56281200C514AA /* Errno.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Errno.swift; sourceTree = "<group>"; };
 		7C5F790E1D56287000C514AA /* Socket+File.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Socket+File.swift"; sourceTree = "<group>"; };
 		7C6B57EA1CA6C3AA0042655C /* SwifterTestsHttpRouter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwifterTestsHttpRouter.swift; sourceTree = "<group>"; };
 		7C7488771C1DA07300CBCD77 /* file.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = file.html; sourceTree = "<group>"; };
@@ -357,7 +396,6 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				7CCD87611C66099B0068099B /* Swifter.framework in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -365,7 +403,6 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				7CCD877E1C660EA30068099B /* Swifter.framework in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -443,7 +480,6 @@
 				7C3195F81CC2C68F00DF5406 /* String+BASE64.swift */,
 				7C3195F91CC2C68F00DF5406 /* String+Misc.swift */,
 				7C2C85901D50D83D00B32145 /* JSON.swift */,
-				7C5F790A1D56281200C514AA /* Errno.swift */,
 			);
 			path = Swifter;
 			sourceTree = "<group>";
@@ -741,7 +777,6 @@
 			buildRules = (
 			);
 			dependencies = (
-				7CCD87631C66099B0068099B /* PBXTargetDependency */,
 			);
 			name = SwifteriOSTests;
 			productName = SwifteriOSTests;
@@ -759,7 +794,6 @@
 			buildRules = (
 			);
 			dependencies = (
-				7CCD87801C660EA30068099B /* PBXTargetDependency */,
 			);
 			name = SwifterOSXTests;
 			productName = SwifterOSXTests;
@@ -910,6 +944,7 @@
 				7CDF26ED1D5CD64600666F69 /* HMAC.swift in Sources */,
 				7C31960D1CC2C68F00DF5406 /* WebSockets.swift in Sources */,
 				7C3195FE1CC2C68F00DF5406 /* sqlite.c in Sources */,
+				7CE425E31D64A30800CCD71A /* JSON.swift in Sources */,
 				7CDF26F51D5CD64600666F69 /* RC4.swift in Sources */,
 				7C3196311CC2C68F00DF5406 /* SQLite.swift in Sources */,
 				7C3196341CC2C68F00DF5406 /* String+BASE64.swift in Sources */,
@@ -927,8 +962,6 @@
 				7C5F79071D5627EE00C514AA /* Socket+Server.swift in Sources */,
 				7C3196221CC2C68F00DF5406 /* HttpServerIO.swift in Sources */,
 				7C31960A1CC2C68F00DF5406 /* Files.swift in Sources */,
-				7CB923CC1D50F11700899E2A /* JSON.swift in Sources */,
-				7C5F790B1D56281200C514AA /* Errno.swift in Sources */,
 				7C3196011CC2C68F00DF5406 /* App.swift in Sources */,
 				7C3196251CC2C68F00DF5406 /* Process.swift in Sources */,
 				7C3196371CC2C68F00DF5406 /* String+Misc.swift in Sources */,
@@ -951,6 +984,7 @@
 				7CDF26EE1D5CD64600666F69 /* HMAC.swift in Sources */,
 				7C31960E1CC2C68F00DF5406 /* WebSockets.swift in Sources */,
 				7C3195FF1CC2C68F00DF5406 /* sqlite.c in Sources */,
+				7CE425E41D64A30800CCD71A /* JSON.swift in Sources */,
 				7CDF26F61D5CD64600666F69 /* RC4.swift in Sources */,
 				7C3196321CC2C68F00DF5406 /* SQLite.swift in Sources */,
 				7C3196351CC2C68F00DF5406 /* String+BASE64.swift in Sources */,
@@ -968,8 +1002,6 @@
 				7C5F79081D5627EE00C514AA /* Socket+Server.swift in Sources */,
 				7C3196231CC2C68F00DF5406 /* HttpServerIO.swift in Sources */,
 				7C31960B1CC2C68F00DF5406 /* Files.swift in Sources */,
-				7CB923CD1D50F11800899E2A /* JSON.swift in Sources */,
-				7C5F790C1D56281200C514AA /* Errno.swift in Sources */,
 				7C3196021CC2C68F00DF5406 /* App.swift in Sources */,
 				7C3196261CC2C68F00DF5406 /* Process.swift in Sources */,
 				7C3196381CC2C68F00DF5406 /* String+Misc.swift in Sources */,
@@ -981,14 +1013,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				7C73C6921C26179C00AEF6CA /* AppDelegate.swift in Sources */,
-				7CDF26EC1D5CD64600666F69 /* HMAC.swift in Sources */,
-				7CDF26F81D5CD64600666F69 /* RSA.swift in Sources */,
-				7CDF26F41D5CD64600666F69 /* RC4.swift in Sources */,
-				7CDF26F01D5CD64600666F69 /* MD5.swift in Sources */,
-				7CDF26FC1D5CD64600666F69 /* SHA1.swift in Sources */,
-				7CDF26E81D5CD64600666F69 /* BigNum.swift in Sources */,
 				7CDAB8161BE2A1D400C8A977 /* ViewController.swift in Sources */,
-				7CDF26E41D5CD64600666F69 /* AES128.swift in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -1025,6 +1050,7 @@
 				7CDF26EF1D5CD64600666F69 /* HMAC.swift in Sources */,
 				7C3196211CC2C68F00DF5406 /* HttpServer.swift in Sources */,
 				7C31960F1CC2C68F00DF5406 /* WebSockets.swift in Sources */,
+				7CE425E51D64A30800CCD71A /* JSON.swift in Sources */,
 				7CDF26F71D5CD64600666F69 /* RC4.swift in Sources */,
 				7C3196001CC2C68F00DF5406 /* sqlite.c in Sources */,
 				7C3196331CC2C68F00DF5406 /* SQLite.swift in Sources */,
@@ -1042,8 +1068,6 @@
 				7C5F79091D5627EE00C514AA /* Socket+Server.swift in Sources */,
 				7C3196241CC2C68F00DF5406 /* HttpServerIO.swift in Sources */,
 				7C31960C1CC2C68F00DF5406 /* Files.swift in Sources */,
-				7CB923CE1D50F11800899E2A /* JSON.swift in Sources */,
-				7C5F790D1D56281200C514AA /* Errno.swift in Sources */,
 				7C3196031CC2C68F00DF5406 /* App.swift in Sources */,
 				7C3196271CC2C68F00DF5406 /* Process.swift in Sources */,
 				7C3196391CC2C68F00DF5406 /* String+Misc.swift in Sources */,
@@ -1054,16 +1078,49 @@
 			isa = PBXSourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				7C615E7F1D63BE7F0082E4BC /* Reflection.swift in Sources */,
+				7C615E831D63BE7F0082E4BC /* SQLite.swift in Sources */,
+				7C615EAB1D63BE8D0082E4BC /* HMAC.swift in Sources */,
+				7C615EB31D63BE8D0082E4BC /* DER.swift in Sources */,
+				7C615E721D63BE7F0082E4BC /* App.swift in Sources */,
+				7C615E821D63BE7F0082E4BC /* Socket+File.swift in Sources */,
+				7C615E791D63BE7F0082E4BC /* HttpRequest.swift in Sources */,
+				7C615E761D63BE7F0082E4BC /* Scopes.swift in Sources */,
 				7C5F78EF1D54BB5600C514AA /* SwifterTestsAES128.swift in Sources */,
+				7C615EB11D63BE8D0082E4BC /* SHA256.swift in Sources */,
+				7C615EAA1D63BE8D0082E4BC /* BigNum.swift in Sources */,
+				7C615E801D63BE7F0082E4BC /* Socket.swift in Sources */,
+				7C615EAF1D63BE8D0082E4BC /* SHA1.swift in Sources */,
+				7C615E7C1D63BE7F0082E4BC /* HttpServer.swift in Sources */,
+				7CE425ED1D64A51B00CCD71A /* sqlite.c in Sources */,
+				7C615E7B1D63BE7F0082E4BC /* HttpRouter.swift in Sources */,
 				7CCD87701C660B250068099B /* SwifterTestsHttpParser.swift in Sources */,
+				7C615EAD1D63BE8D0082E4BC /* RC4.swift in Sources */,
 				7C5F79041D55F44500C514AA /* SwifterTestsRSA.swift in Sources */,
 				7C6B57EB1CA6C3AA0042655C /* SwifterTestsHttpRouter.swift in Sources */,
 				7C00AAC21D5D995900EDA547 /* SwifterTestsBigNum.swift in Sources */,
+				7C615EAC1D63BE8D0082E4BC /* MD5.swift in Sources */,
 				7C5915221C92A99300D884BC /* SwifterTestsReflection.swift in Sources */,
+				7C615E781D63BE7F0082E4BC /* HttpParser.swift in Sources */,
+				7C615EA91D63BE8D0082E4BC /* AES128.swift in Sources */,
+				7CE425E91D64A45A00CCD71A /* JSON.swift in Sources */,
+				7C615E7D1D63BE7F0082E4BC /* HttpServerIO.swift in Sources */,
+				7C615EB21D63BE8D0082E4BC /* Socket+TLS.swift in Sources */,
+				7C615EAE1D63BE8D0082E4BC /* RSA.swift in Sources */,
 				7C13B57C1C7B069500556443 /* SwifterTestsSQLite.swift in Sources */,
 				7CB923D01D510D6400899E2A /* SwifterTestsJSON.swift in Sources */,
+				7C615E841D63BE7F0082E4BC /* String+BASE64.swift in Sources */,
+				7C615E7A1D63BE7F0082E4BC /* HttpResponse.swift in Sources */,
+				7C615E7E1D63BE7F0082E4BC /* Process.swift in Sources */,
+				7CE425EB1D64A4F900CCD71A /* HEX.swift in Sources */,
+				7C615E751D63BE7F0082E4BC /* Files.swift in Sources */,
+				7C615E731D63BE7F0082E4BC /* DemoServer.swift in Sources */,
+				7C615E741D63BE7F0082E4BC /* File.swift in Sources */,
+				7C615E771D63BE7F0082E4BC /* WebSockets.swift in Sources */,
+				7C615E851D63BE7F0082E4BC /* String+Misc.swift in Sources */,
 				7C4785E91C71D15600A9FE73 /* SwifterTestsWebSocketSession.swift in Sources */,
 				7C5F78F91D54D24B00C514AA /* SwifterTestsRC4.swift in Sources */,
+				7C615E811D63BE7F0082E4BC /* Socket+Server.swift in Sources */,
 				7CE0B9EF1D5BBAAD0070D292 /* SwifterTestsHMAC.swift in Sources */,
 				7CCD87721C660B250068099B /* SwifterTestsStringExtensions.swift in Sources */,
 			);
@@ -1073,16 +1130,49 @@
 			isa = PBXSourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				7C615EA11D63BE810082E4BC /* Reflection.swift in Sources */,
+				7C615EA51D63BE810082E4BC /* SQLite.swift in Sources */,
+				7C615EB61D63BE8E0082E4BC /* HMAC.swift in Sources */,
+				7C615EBE1D63BE8E0082E4BC /* DER.swift in Sources */,
+				7C615E941D63BE810082E4BC /* App.swift in Sources */,
+				7C615EA41D63BE810082E4BC /* Socket+File.swift in Sources */,
+				7C615E9B1D63BE810082E4BC /* HttpRequest.swift in Sources */,
+				7C615E981D63BE810082E4BC /* Scopes.swift in Sources */,
 				7C5F78F01D54BB5600C514AA /* SwifterTestsAES128.swift in Sources */,
+				7C615EBC1D63BE8E0082E4BC /* SHA256.swift in Sources */,
+				7C615EB51D63BE8E0082E4BC /* BigNum.swift in Sources */,
+				7C615EA21D63BE810082E4BC /* Socket.swift in Sources */,
+				7C615EBA1D63BE8E0082E4BC /* SHA1.swift in Sources */,
+				7C615E9E1D63BE810082E4BC /* HttpServer.swift in Sources */,
+				7CE425EE1D64A51B00CCD71A /* sqlite.c in Sources */,
+				7C615E9D1D63BE810082E4BC /* HttpRouter.swift in Sources */,
 				7CCD87841C660ED60068099B /* SwifterTestsHttpParser.swift in Sources */,
+				7C615EB81D63BE8E0082E4BC /* RC4.swift in Sources */,
 				7C5F79051D55F44500C514AA /* SwifterTestsRSA.swift in Sources */,
 				7C6B57EC1CA6C3AA0042655C /* SwifterTestsHttpRouter.swift in Sources */,
 				7C00AAC31D5D995900EDA547 /* SwifterTestsBigNum.swift in Sources */,
+				7C615EB71D63BE8E0082E4BC /* MD5.swift in Sources */,
 				7C5915231C92A99300D884BC /* SwifterTestsReflection.swift in Sources */,
+				7C615E9A1D63BE810082E4BC /* HttpParser.swift in Sources */,
+				7C615EB41D63BE8E0082E4BC /* AES128.swift in Sources */,
+				7CE425EA1D64A45B00CCD71A /* JSON.swift in Sources */,
+				7C615E9F1D63BE810082E4BC /* HttpServerIO.swift in Sources */,
+				7C615EBD1D63BE8E0082E4BC /* Socket+TLS.swift in Sources */,
+				7C615EB91D63BE8E0082E4BC /* RSA.swift in Sources */,
 				7C13B57D1C7B069500556443 /* SwifterTestsSQLite.swift in Sources */,
 				7CB923D11D510D6400899E2A /* SwifterTestsJSON.swift in Sources */,
+				7C615EA61D63BE810082E4BC /* String+BASE64.swift in Sources */,
+				7C615E9C1D63BE810082E4BC /* HttpResponse.swift in Sources */,
+				7C615EA01D63BE810082E4BC /* Process.swift in Sources */,
+				7CE425EC1D64A4F900CCD71A /* HEX.swift in Sources */,
+				7C615E971D63BE810082E4BC /* Files.swift in Sources */,
+				7C615E951D63BE810082E4BC /* DemoServer.swift in Sources */,
+				7C615E961D63BE810082E4BC /* File.swift in Sources */,
+				7C615E991D63BE810082E4BC /* WebSockets.swift in Sources */,
+				7C615EA71D63BE810082E4BC /* String+Misc.swift in Sources */,
 				7C4785EA1C71D15600A9FE73 /* SwifterTestsWebSocketSession.swift in Sources */,
 				7C5F78FA1D54D24B00C514AA /* SwifterTestsRC4.swift in Sources */,
+				7C615EA31D63BE810082E4BC /* Socket+Server.swift in Sources */,
 				7CE0B9F01D5BBAAD0070D292 /* SwifterTestsHMAC.swift in Sources */,
 				7CCD87851C660ED60068099B /* SwifterTestsStringExtensions.swift in Sources */,
 			);
@@ -1106,16 +1196,6 @@
 			target = 7CCD1BA81C8F84E60016D664 /* SwiftertvOS */;
 			targetProxy = 7CCD1BC61C8F857F0016D664 /* PBXContainerItemProxy */;
 		};
-		7CCD87631C66099B0068099B /* PBXTargetDependency */ = {
-			isa = PBXTargetDependency;
-			target = 7AE893E61C05127900A29F63 /* SwifteriOS */;
-			targetProxy = 7CCD87621C66099B0068099B /* PBXContainerItemProxy */;
-		};
-		7CCD87801C660EA30068099B /* PBXTargetDependency */ = {
-			isa = PBXTargetDependency;
-			target = 7AE893FA1C0512C400A29F63 /* SwifterMac */;
-			targetProxy = 7CCD877F1C660EA30068099B /* PBXContainerItemProxy */;
-		};
 /* End PBXTargetDependency section */
 
 /* Begin PBXVariantGroup section */

+ 2 - 1
XCode/SwifterSampleOSX/main.swift

@@ -12,7 +12,8 @@ do {
     server["/testAfterBaseRoute"] = { request in
         return .ok(.html("ok !"))
     }
-    
+
+
     server["/lightroom"] = { r in
         
         print(String.fromUInt8(r.body))

+ 16 - 17
XCode/SwifterTestsCommon/SwifterTestsAES128.swift

@@ -7,7 +7,6 @@
 //
 
 import XCTest
-import Swifter
 
 class SwifterTestsAES: XCTestCase {
     
@@ -42,25 +41,25 @@ class SwifterTestsAES: XCTestCase {
         
         let encrypted = AES128.encryptBlock(text, key)
         
-        XCTAssert(encrypted.s00 == 0x39)
-        XCTAssert(encrypted.s10 == 0x25)
-        XCTAssert(encrypted.s20 == 0x84)
-        XCTAssert(encrypted.s30 == 0x1d)
+        XCTAssertEqual(encrypted.s00, 0x39)
+        XCTAssertEqual(encrypted.s10, 0x25)
+        XCTAssertEqual(encrypted.s20, 0x84)
+        XCTAssertEqual(encrypted.s30, 0x1d)
         
-        XCTAssert(encrypted.s01 == 0x02)
-        XCTAssert(encrypted.s11 == 0xdc)
-        XCTAssert(encrypted.s21 == 0x09)
-        XCTAssert(encrypted.s31 == 0xfb)
+        XCTAssertEqual(encrypted.s01, 0x02)
+        XCTAssertEqual(encrypted.s11, 0xdc)
+        XCTAssertEqual(encrypted.s21, 0x09)
+        XCTAssertEqual(encrypted.s31, 0xfb)
         
-        XCTAssert(encrypted.s02 == 0xdc)
-        XCTAssert(encrypted.s12 == 0x11)
-        XCTAssert(encrypted.s22 == 0x85)
-        XCTAssert(encrypted.s32 == 0x97)
+        XCTAssertEqual(encrypted.s02, 0xdc)
+        XCTAssertEqual(encrypted.s12, 0x11)
+        XCTAssertEqual(encrypted.s22, 0x85)
+        XCTAssertEqual(encrypted.s32, 0x97)
         
-        XCTAssert(encrypted.s03 == 0x19)
-        XCTAssert(encrypted.s13 == 0x6a)
-        XCTAssert(encrypted.s23 == 0x0b)
-        XCTAssert(encrypted.s33 == 0x32)
+        XCTAssertEqual(encrypted.s03, 0x19)
+        XCTAssertEqual(encrypted.s13, 0x6a)
+        XCTAssertEqual(encrypted.s23, 0x0b)
+        XCTAssertEqual(encrypted.s33, 0x32)
         
     }
 }

+ 0 - 1
XCode/SwifterTestsCommon/SwifterTestsBigNum.swift

@@ -6,7 +6,6 @@
 //
 
 import XCTest
-import Swifter
 
 class SwifterTestsBigNum: XCTestCase {
     

+ 0 - 1
XCode/SwifterTestsCommon/SwifterTestsHMAC.swift

@@ -6,7 +6,6 @@
 //
 
 import XCTest
-import Swifter
 
 class SwifterTestsHMAC: XCTestCase {
     

+ 6 - 7
XCode/SwifterTestsCommon/SwifterTestsHttpParser.swift

@@ -6,7 +6,6 @@
 //
 
 import XCTest
-import Swifter
 
 class SwifterTestsHttpParser: XCTestCase {
     
@@ -91,15 +90,15 @@ class SwifterTestsHttpParser: XCTestCase {
         } catch { }
         
         var r = try? parser.readHttpRequest(TestSocket("GET / HTTP/1.0\nContent-Length: 10\n\n1234567890"))
-        XCTAssert(r?.method == "GET", "Parser should extract HTTP method name from the status line.")
-        XCTAssert(r?.path == "/", "Parser should extract HTTP path value from the status line.")
-        XCTAssert(r?.headers["content-length"] == "10", "Parser should extract Content-Length header value.")
+        XCTAssertEqual(r?.method, "GET", "Parser should extract HTTP method name from the status line.")
+        XCTAssertEqual(r?.path, "/", "Parser should extract HTTP path value from the status line.")
+        XCTAssertEqual(r?.headers["content-length"], "10", "Parser should extract Content-Length header value.")
         
         r = try? parser.readHttpRequest(TestSocket("POST / HTTP/1.0\nContent-Length: 10\n\n1234567890"))
-        XCTAssert(r?.method == "POST", "Parser should extract HTTP method name from the status line.")
+        XCTAssertEqual(r?.method, "POST", "Parser should extract HTTP method name from the status line.")
         
         r = try? parser.readHttpRequest(TestSocket("GET / HTTP/1.0\nHeader1: 1\nHeader2: 2\nContent-Length: 0\n\n"))
-        XCTAssert(r?.headers["header1"] == "1", "Parser should extract multiple headers from the request.")
-        XCTAssert(r?.headers["header2"] == "2", "Parser should extract multiple headers from the request.")
+        XCTAssertEqual(r?.headers["header1"], "1", "Parser should extract multiple headers from the request.")
+        XCTAssertEqual(r?.headers["header2"], "2", "Parser should extract multiple headers from the request.")
     }
 }

+ 28 - 29
XCode/SwifterTestsCommon/SwifterTestsHttpRouter.swift

@@ -7,7 +7,6 @@
 //
 
 import XCTest
-import Swifter
 
 class SwifterTestsHttpRouter: XCTestCase {
 
@@ -19,7 +18,7 @@ class SwifterTestsHttpRouter: XCTestCase {
             return .ok(.html("OK"))
         })
         
-        XCTAssert(router.route(nil, path: "/") != nil)
+        XCTAssertNotNil(router.route(nil, path: "/"))
     }
     
     func testHttpRouterSimplePathSegments() {
@@ -30,11 +29,11 @@ class SwifterTestsHttpRouter: XCTestCase {
             return .ok(.html("OK"))
         })
         
-        XCTAssert(router.route(nil, path: "/") == nil)
-        XCTAssert(router.route(nil, path: "/a") == nil)
-        XCTAssert(router.route(nil, path: "/a/b") == nil)
-        XCTAssert(router.route(nil, path: "/a/b/c") == nil)
-        XCTAssert(router.route(nil, path: "/a/b/c/d") != nil)
+        XCTAssertNil(router.route(nil, path: "/"))
+        XCTAssertNil(router.route(nil, path: "/a"))
+        XCTAssertNil(router.route(nil, path: "/a/b"))
+        XCTAssertNil(router.route(nil, path: "/a/b/c"))
+        XCTAssertNotNil(router.route(nil, path: "/a/b/c/d"))
     }
     
     func testHttpRouterSinglePathSegmentWildcard() {
@@ -45,12 +44,12 @@ class SwifterTestsHttpRouter: XCTestCase {
             return .ok(.html("OK"))
         })
         
-        XCTAssert(router.route(nil, path: "/") == nil)
-        XCTAssert(router.route(nil, path: "/a") == nil)
-        XCTAssert(router.route(nil, path: "/a/foo/c/d") != nil)
-        XCTAssert(router.route(nil, path: "/a/b/c/d") != nil)
-        XCTAssert(router.route(nil, path: "/a/b") == nil)
-        XCTAssert(router.route(nil, path: "/a/b/foo/d") == nil)
+        XCTAssertNil(router.route(nil, path: "/"))
+        XCTAssertNil(router.route(nil, path: "/a"))
+        XCTAssertNotNil(router.route(nil, path: "/a/foo/c/d"))
+        XCTAssertNotNil(router.route(nil, path: "/a/b/c/d"))
+        XCTAssertNil(router.route(nil, path: "/a/b"))
+        XCTAssertNil(router.route(nil, path: "/a/b/foo/d"))
     }
     
     func testHttpRouterVariables() {
@@ -61,12 +60,12 @@ class SwifterTestsHttpRouter: XCTestCase {
             return .ok(.html("OK"))
         })
         
-        XCTAssert(router.route(nil, path: "/") == nil)
-        XCTAssert(router.route(nil, path: "/a") == nil)
-        XCTAssert(router.route(nil, path: "/a/b/c/d") == nil)
-        XCTAssert(router.route(nil, path: "/a/value1/value2/b/c/d/value3")?.0[":arg1"] == "value1")
-        XCTAssert(router.route(nil, path: "/a/value1/value2/b/c/d/value3")?.0[":arg2"] == "value2")
-        XCTAssert(router.route(nil, path: "/a/value1/value2/b/c/d/value3")?.0[":arg3"] == "value3")
+        XCTAssertNil(router.route(nil, path: "/"))
+        XCTAssertNil(router.route(nil, path: "/a"))
+        XCTAssertNil(router.route(nil, path: "/a/b/c/d"))
+        XCTAssertEqual(router.route(nil, path: "/a/value1/value2/b/c/d/value3")?.0[":arg1"], "value1")
+        XCTAssertEqual(router.route(nil, path: "/a/value1/value2/b/c/d/value3")?.0[":arg2"], "value2")
+        XCTAssertEqual(router.route(nil, path: "/a/value1/value2/b/c/d/value3")?.0[":arg3"], "value3")
     }
     
     func testHttpRouterMultiplePathSegmentWildcards() {
@@ -77,10 +76,10 @@ class SwifterTestsHttpRouter: XCTestCase {
             return .ok(.html("OK"))
         })
         
-        XCTAssert(router.route(nil, path: "/") == nil)
-        XCTAssert(router.route(nil, path: "/a") == nil)
-        XCTAssert(router.route(nil, path: "/a/b/c/d/e/f/g") != nil)
-        XCTAssert(router.route(nil, path: "/a/e/f/g") == nil)
+        XCTAssertNil(router.route(nil, path: "/"))
+        XCTAssertNil(router.route(nil, path: "/a"))
+        XCTAssertNotNil(router.route(nil, path: "/a/b/c/d/e/f/g"))
+        XCTAssertNil(router.route(nil, path: "/a/e/f/g"))
     }
     
     func testHttpRouterEmptyTail() {
@@ -96,14 +95,14 @@ class SwifterTestsHttpRouter: XCTestCase {
         })
 
         
-        XCTAssert(router.route(nil, path: "/") == nil)
-        XCTAssert(router.route(nil, path: "/a") == nil)
-        XCTAssert(router.route(nil, path: "/a/b/") != nil)
-        XCTAssert(router.route(nil, path: "/a/e/f/g") == nil)
+        XCTAssertNil(router.route(nil, path: "/"))
+        XCTAssertNil(router.route(nil, path: "/a"))
+        XCTAssertNotNil(router.route(nil, path: "/a/b/"))
+        XCTAssertNil(router.route(nil, path: "/a/e/f/g"))
         
-        XCTAssert(router.route(nil, path: "/a/b/value1")?.0[":var"] == "value1")
+        XCTAssertEqual(router.route(nil, path: "/a/b/value1")?.0[":var"], "value1")
         
-        XCTAssert(router.route(nil, path: "/a/b/")?.0[":var"] == "")
+        XCTAssertEqual(router.route(nil, path: "/a/b/")?.0[":var"], "")
     }
 
 }

+ 9 - 44
XCode/SwifterTestsCommon/SwifterTestsJSON.swift

@@ -6,55 +6,20 @@
 //
 
 import XCTest
-import Swifter
 
 class SwifterTestsSwfitJSON: XCTestCase {
     
-    func testJSONStringEscape() {
-        
-        XCTAssertEqual("".asJson(0), "\"\"")
-        XCTAssertEqual("\"".asJson(0), "\"\\\"\"")
-        XCTAssertEqual("\\".asJson(0), "\"\\\\\"")
-        XCTAssertEqual("/".asJson(0), "\"\\/\"")
-        
-        XCTAssertEqual("\u{8}".asJson(0), "\"\\b\"")
-        XCTAssertEqual("\u{0C}".asJson(0), "\"\\f\"")
-        XCTAssertEqual("\r".asJson(0), "\"\\r\"")
-        XCTAssertEqual("\n".asJson(0), "\"\\n\"")
-        XCTAssertEqual("\t".asJson(0), "\"\\t\"")
-        
-        XCTAssertEqual("ę".asJson(0), "\"\\u0119\"")
-        XCTAssertEqual("한".asJson(0), "\"\\uD55C\"")
-        XCTAssertEqual("💖".asJson(0), "\"\\u1F496\"")
-        XCTAssertEqual("🐪".asJson(0), "\"\\u1F42A\"")
-        
-        // From Ruby: https://github.com/ruby/ruby/blob/trunk/test/json/json_encoding_test.rb
+    func testJSONObject() {
         
-        XCTAssertEqual("© ≠ €!".asJson(0), "\"\\u00A9 \\u2260 \\u20AC!\"")
-    }
-    
-    func testJSONNumber() {
-        XCTAssertEqual(0.asJson(0), "0")
-        XCTAssertEqual(1.asJson(0), "1")
-        XCTAssertEqual(99999.asJson(0), "99999")
+        var array = [Any?]()
+        array.append(nil)
+        XCTAssertEqual(array.asJson(), "[null]")
         
-        XCTAssertEqual((1.01).asJson(0), "1.01")
-        XCTAssertEqual((1.0).asJson(0), "1.0")
-        XCTAssertEqual(Double(1.01).asJson(0), "1.01")
-    }
-
-    
-    func testJSONBool() {
-        XCTAssertEqual(true.asJson(0), "true")
-        XCTAssertEqual(false.asJson(0), "false")
-    }
-
-    
-    func testJSONObject() {
-        XCTAssertEqual([1, 2].asJson(0), "[1,2]")
-        XCTAssertEqual(["key1" : [1, 2]].asJson(0), "{\"key1\":[1,2]}")
-        XCTAssertEqual(["key1" : ["key2": ["key3": false]]].asJson(0), "{\"key1\":{\"key2\":{\"key3\":false}}}")
-        XCTAssertEqual(["key1" : ["key2": ["key3": false, "key4": 1]]].asJson(0), "{\"key1\":{\"key2\":{\"key4\":1,\"key3\":false}}}")
+        XCTAssertEqual([1, false].asJson(), "[1,false]")
+        XCTAssertEqual([1, 2].asJson(), "[1,2]")
+        XCTAssertEqual(["key1" : [1, 2]].asJson(), "{\"key1\":[1,2]}")
+        XCTAssertEqual(["key1" : ["key2": ["key3": false]]].asJson(), "{\"key1\":{\"key2\":{\"key3\":false}}}")
+        XCTAssertEqual(["key1" : ["key2": ["key3": false, "key4": 1]]].asJson(), "{\"key1\":{\"key2\":{\"key4\":1,\"key3\":false}}}")
     }
     
 }

+ 2 - 3
XCode/SwifterTestsCommon/SwifterTestsRC4.swift

@@ -6,7 +6,6 @@
 //
 
 import XCTest
-import Swifter
 
 class SwifterTestsRC4: XCTestCase {
     
@@ -14,10 +13,10 @@ class SwifterTestsRC4: XCTestCase {
         
         let encrypted = RC4.encrypt([UInt8]("Plaintext".utf8), [UInt8]("Key".utf8))
         
-        XCTAssertTrue(encrypted == [0xbb, 0xf3, 0x16, 0xe8, 0xd9, 0x40, 0xaf, 0x0a, 0xd3])
+        XCTAssertEqual(encrypted, [0xbb, 0xf3, 0x16, 0xe8, 0xd9, 0x40, 0xaf, 0x0a, 0xd3])
         
         let decrypted = RC4.decrypt([0xbb, 0xf3, 0x16, 0xe8, 0xd9, 0x40, 0xaf, 0x0a, 0xd3], [UInt8]("Key".utf8))
         
-        XCTAssertTrue(decrypted == [UInt8]("Plaintext".utf8))
+        XCTAssertEqual(decrypted, [UInt8]("Plaintext".utf8))
     }
 }

+ 0 - 1
XCode/SwifterTestsCommon/SwifterTestsRSA.swift

@@ -6,7 +6,6 @@
 //
 
 import XCTest
-import Swifter
 
 class SwifterTestsRSA: XCTestCase {
     

+ 1 - 2
XCode/SwifterTestsCommon/SwifterTestsReflection.swift

@@ -6,11 +6,10 @@
 //
 
 import XCTest
-import Swifter
 
 class SwifterTestsReflection: XCTestCase {
     
-    class BlogPost: DatabaseReflection {
+    public class BlogPost: DatabaseReflection {
         
         var message: String?
         var author: String?

+ 2 - 3
XCode/SwifterTestsCommon/SwifterTestsSQLite.swift

@@ -6,7 +6,6 @@
 //
 
 import XCTest
-import Swifter
 
 class SwifterTestsSQLite: XCTestCase {
     
@@ -45,13 +44,13 @@ class SwifterTestsSQLite: XCTestCase {
             for _ in try database.enumerate("SELECT * FROM swifter_tests;") {
                 counter = counter + 1
             }
-            XCTAssert(counter == 2, "Database should have two rows.")
+            XCTAssertEqual(counter, 2, "Database should have two rows.")
             
             counter = 0
             try database.exec("SELECT * FROM swifter_tests;") { content in
                 counter = counter + 1
             }
-            XCTAssert(counter == 2, "Database should have two rows.")
+            XCTAssertEqual(counter, 2, "Database should have two rows.")
             
             database.close()
         } catch {

+ 0 - 1
XCode/SwifterTestsCommon/SwifterTestsStringExtensions.swift

@@ -6,7 +6,6 @@
 //
 
 import XCTest
-import Swifter
 
 class SwifterTestsStringExtensions: XCTestCase {
     

+ 0 - 1
XCode/SwifterTestsCommon/SwifterTestsWebSocketSession.swift

@@ -6,7 +6,6 @@
 //
 
 import XCTest
-import Swifter
 
 class SwifterTestsWebSocketSession: XCTestCase {