diff --git a/OptJSON.xcodeproj/project.pbxproj b/OptJSON.xcodeproj/project.pbxproj index 24ed686..36e0a78 100644 --- a/OptJSON.xcodeproj/project.pbxproj +++ b/OptJSON.xcodeproj/project.pbxproj @@ -164,6 +164,7 @@ 50FCCCA6195C5F2100095152 /* Project object */ = { isa = PBXProject; attributes = { + LastSwiftMigration = 0700; LastUpgradeCheck = 0600; TargetAttributes = { 50FCCCAE195C5F2100095152 = { @@ -360,10 +361,6 @@ 50FCCCC9195C5F2100095152 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - ); GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", @@ -378,10 +375,6 @@ 50FCCCCA195C5F2100095152 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - ); INFOPLIST_FILE = OptJSONTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; METAL_ENABLE_DEBUG_INFO = NO; diff --git a/OptJSON/OptJSON.swift b/OptJSON/OptJSON.swift index b1d6f30..3456fea 100644 --- a/OptJSON/OptJSON.swift +++ b/OptJSON/OptJSON.swift @@ -9,33 +9,27 @@ import Foundation public protocol JSONValue { - subscript(#key: String) -> JSONValue? { get } - subscript(#index: Int) -> JSONValue? { get } + subscript(key key: String) -> JSONValue? { get } + subscript(index index: Int) -> JSONValue? { get } } -extension NSNull : JSONValue { - public subscript(#key: String) -> JSONValue? { return nil } - public subscript(#index: Int) -> JSONValue? { return nil } +extension JSONValue { + public subscript(key key: String) -> JSONValue? { return nil } + public subscript(index index: Int) -> JSONValue? { return nil } } -extension NSNumber : JSONValue { - public subscript(#key: String) -> JSONValue? { return nil } - public subscript(#index: Int) -> JSONValue? { return nil } -} +extension NSNull : JSONValue { } -extension NSString : JSONValue { - public subscript(#key: String) -> JSONValue? { return nil } - public subscript(#index: Int) -> JSONValue? { return nil } -} +extension NSNumber : JSONValue { } + +extension NSString : JSONValue { } extension NSArray : JSONValue { - public subscript(#key: String) -> JSONValue? { return nil } - public subscript(#index: Int) -> JSONValue? { return index < count && index >= 0 ? JSON(self[index]) : nil } + public subscript(index index: Int) -> JSONValue? { return index < count && index >= 0 ? JSON(self[index]) : nil } } extension NSDictionary : JSONValue { - public subscript(#key: String) -> JSONValue? { return JSON(self[key]) } - public subscript(#index: Int) -> JSONValue? { return nil } + public subscript(key key: String) -> JSONValue? { return JSON(self[key]) } } public func JSON(object: AnyObject?) -> JSONValue? { diff --git a/OptJSONTests/AltJSONTests.swift b/OptJSONTests/AltJSONTests.swift index 57db260..b8a0972 100644 --- a/OptJSONTests/AltJSONTests.swift +++ b/OptJSONTests/AltJSONTests.swift @@ -52,8 +52,8 @@ let altJSON : AltJSON = [ class AltJSONTests: XCTestCase { let nsJSON : AnyObject! = { - let data = NSJSONSerialization.dataWithJSONObject(altJSON, options: NSJSONWritingOptions(0), error: nil) - return NSJSONSerialization.JSONObjectWithData(data!, options: NSJSONReadingOptions(0), error: nil) + let data = try? NSJSONSerialization.dataWithJSONObject(altJSON, options: NSJSONWritingOptions(rawValue: 0)) + return try? NSJSONSerialization.JSONObjectWithData(data!, options: NSJSONReadingOptions(rawValue: 0)) }() func testBaseTypes() { diff --git a/OptJSONTests/OptJSONTests.swift b/OptJSONTests/OptJSONTests.swift index 958cd09..5e6553e 100644 --- a/OptJSONTests/OptJSONTests.swift +++ b/OptJSONTests/OptJSONTests.swift @@ -33,8 +33,8 @@ let nativeJSON = [ class OptJSONTests: XCTestCase { let nsJSON : AnyObject! = { - let data = NSJSONSerialization.dataWithJSONObject(nativeJSON, options: NSJSONWritingOptions(0), error: nil) - return NSJSONSerialization.JSONObjectWithData(data!, options: NSJSONReadingOptions(0), error: nil) + let data = try? NSJSONSerialization.dataWithJSONObject(nativeJSON, options: NSJSONWritingOptions(rawValue: 0)) + return try? NSJSONSerialization.JSONObjectWithData(data!, options: NSJSONReadingOptions(rawValue: 0)) }() func testBaseTypes() {