We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f8d4d57 commit 764c0c8Copy full SHA for 764c0c8
Source/SwiftyJSON/SwiftyJSON.swift
@@ -236,7 +236,7 @@ public struct JSON {
236
rawString = string
237
case _ as NSNull:
238
type = .null
239
- case nil:
+ case Optional<Any>.none:
240
241
case let array as [Any]:
242
type = .array
Tests/SwiftJSONTests/RawRepresentableTests.swift
@@ -84,6 +84,12 @@ class RawRepresentableTests: XCTestCase {
84
if JSON(rawValue: NSObject()) != nil {
85
XCTFail("Should not run into here")
86
}
87
+
88
+ do {
89
+ let n: Int? = nil
90
+ let json = JSON(n as Any)
91
+ XCTAssertEqual(json.type, .null)
92
+ }
93
94
95
func testArray() {
0 commit comments