Skip to content

Commit ac4f559

Browse files
committed
修复报错
1 parent 4b3983c commit ac4f559

4 files changed

Lines changed: 36 additions & 36 deletions

File tree

Example/Pods/CodableWrapper/Package.resolved

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/SmartCodable/Test2ViewController.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,12 @@ class Test2ViewController: BaseViewController {
2222
]
2323

2424
let model = StudentModel.deserialize(from: dict)
25-
print(model?.name)
26-
print(model?.age)
25+
print(model?.name as Any)
26+
print(model?.age as Any)
2727

28+
let transDict = model?.toJSONString(prettyPrint: true) ?? ""
29+
print("\n Model -> JSON")
30+
print(transDict)
2831
}
2932

3033
class BaseModel: SmartCodable {

Example/SmartCodable/测试用例/解码/数据测试/SpecialData/SpecialData_dataViewController.swift

Lines changed: 17 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -50,40 +50,24 @@ extension SpecialData_dataViewController {
5050
}
5151

5252

53-
func getDictData(
54-
mode: Mode,
55-
strategy: JSONDecoder.SmartDataDecodingStrategy) -> [String: Any] {
56-
switch mode {
57-
case .keyless:
58-
return [:]
59-
case .null:
60-
return [
61-
"aData": NSNull(),
62-
"bData": NSNull(),
63-
]
64-
case .typeMismatch:
65-
return [
66-
"aData": [],
67-
"bData": [ : ]
68-
]
69-
case .normal:
70-
break
71-
}
72-
73-
74-
75-
76-
switch strategy {
77-
78-
79-
case .base64:
80-
return [
81-
"aData": "aHR0cHM6Ly93d3cucWl4aW4uY29t",
82-
"bData": "aHR0cHM6Ly93d3cucWl4aW4uY29t",
83-
]
84-
}
85-
53+
func getDictData(mode: Mode, strategy: JSONDecoder.SmartDataDecodingStrategy) -> [String: Any] {
54+
switch mode {
55+
case .keyless:
56+
return [:]
57+
case .null:
58+
return [
59+
"aData": NSNull(),
60+
"bData": NSNull(),
61+
]
62+
case .typeMismatch:
63+
return [
64+
"aData": [],
65+
"bData": [ : ]
66+
]
67+
case .normal:
68+
return [:]
8669
}
70+
}
8771
}
8872

8973

Sources/SmartCodable/Core/SmartCodable/SmartEncodable.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ extension SmartEncodable {
7575
/// - Parameter options: encoding options
7676
/// - Returns: dictionary
7777

78-
7978
/// Serializes the object into a dictionary representation.
8079
///
8180
/// - Parameters:

0 commit comments

Comments
 (0)