Skip to content

Commit 04d4f92

Browse files
saiHemakparkera
authored andcommitted
Changes done to NSJSONSerialization to align with darwin code (#373)
1 parent d632ebf commit 04d4f92

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Foundation/NSJSONSerialization.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ public struct NSJSONReadingOptions : OptionSet {
1717
public let rawValue : UInt
1818
public init(rawValue: UInt) { self.rawValue = rawValue }
1919

20-
public static let MutableContainers = NSJSONReadingOptions(rawValue: 1 << 0)
21-
public static let MutableLeaves = NSJSONReadingOptions(rawValue: 1 << 1)
22-
public static let AllowFragments = NSJSONReadingOptions(rawValue: 1 << 2)
20+
public static let mutableContainers = NSJSONReadingOptions(rawValue: 1 << 0)
21+
public static let mutableLeaves = NSJSONReadingOptions(rawValue: 1 << 1)
22+
public static let allowFragments = NSJSONReadingOptions(rawValue: 1 << 2)
2323
}
2424

2525
public struct NSJSONWritingOptions : OptionSet {
2626
public let rawValue : UInt
2727
public init(rawValue: UInt) { self.rawValue = rawValue }
2828

29-
public static let PrettyPrinted = NSJSONWritingOptions(rawValue: 1 << 0)
29+
public static let prettyPrinted = NSJSONWritingOptions(rawValue: 1 << 0)
3030
}
3131

3232

@@ -106,7 +106,7 @@ public class NSJSONSerialization : NSObject {
106106
let result = NSMutableData()
107107

108108
var writer = JSONWriter(
109-
pretty: opt.contains(.PrettyPrinted),
109+
pretty: opt.contains(.prettyPrinted),
110110
writer: { (str: String?) in
111111
if let str = str {
112112
result.append(str.bridge().cString(using: NSUTF8StringEncoding)!, length: str.lengthOfBytes(using: NSUTF8StringEncoding))
@@ -145,7 +145,7 @@ public class NSJSONSerialization : NSObject {
145145
else if let (array, _) = try reader.parseArray(0) {
146146
return array
147147
}
148-
else if opt.contains(.AllowFragments), let (value, _) = try reader.parseValue(0) {
148+
else if opt.contains(.allowFragments), let (value, _) = try reader.parseValue(0) {
149149
return value
150150
}
151151
throw NSError(domain: NSCocoaErrorDomain, code: NSCocoaError.PropertyListReadCorruptError.rawValue, userInfo: [

TestFoundation/TestNSJSONSerialization.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ extension TestNSJSONSerialization {
327327
XCTFail("Unable to convert string to data")
328328
return
329329
}
330-
let result = try NSJSONSerialization.jsonObject(with: data, options: .AllowFragments) as? Int
330+
let result = try NSJSONSerialization.jsonObject(with: data, options: .allowFragments) as? Int
331331
XCTAssertEqual(result, 3)
332332
}
333333
} catch {

0 commit comments

Comments
 (0)