Skip to content

Commit 5ae6142

Browse files
committed
bugfix
1 parent 18b8cf3 commit 5ae6142

4 files changed

Lines changed: 15 additions & 26 deletions

File tree

Example/Podfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ PODS:
88
- FBSnapshotTestCase/SwiftSupport (2.1.4):
99
- FBSnapshotTestCase/Core
1010
- HandyJSON (5.0.0-beta.1)
11-
- SmartCodable/Core (6.0.2)
12-
- SmartCodable/Inherit (6.0.2):
11+
- SmartCodable/Core (6.0.5)
12+
- SmartCodable/Inherit (6.0.5):
1313
- SmartCodable/Core
1414
- SnapKit (5.6.0)
1515

@@ -41,7 +41,7 @@ SPEC CHECKSUMS:
4141
CleanJSON: 910a36465ce4829e264a902ccf6d1455fdd9f980
4242
FBSnapshotTestCase: 094f9f314decbabe373b87cc339bea235a63e07a
4343
HandyJSON: 582477127ab3ab65bd2e471815f1a7b846856978
44-
SmartCodable: a8a59bc428a1405fe4228d1da4142c845938b14b
44+
SmartCodable: 78f9dd8dab3f8c0d79b56560237c9d04f3e11cd8
4545
SnapKit: e01d52ebb8ddbc333eefe2132acf85c8227d9c25
4646

4747
PODFILE CHECKSUM: fbd909bd1bf3747400cd705163fad38954f6a18f

Example/SmartCodable/TestViewController.swift

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -31,32 +31,21 @@ class TestViewController: BaseViewController {
3131
}
3232

3333
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
34-
let dict: [String: Any] = [
35-
"ages": ["Tom", 1, [:], 2, 3, "4"],
36-
"frinds": [
37-
[], ["name": "Tom"], ["name": "小明"], ["name": "Mccc"],
38-
],
39-
"others": [1, "Tom", ["name": "Tom"]]
40-
]
4134

42-
guard let student = Model.deserialize(from: dict) else { return }
43-
print("⭐️解析结果: ages = \(student.ages)")
44-
print("⭐️解析结果: frinds = \(student.frinds)")
45-
print("⭐️解析结果: others = \(student.others)")
35+
var model = Model()
36+
model.date = Date()
37+
38+
let dict = model.toDictionary(options: [.date(.millisecondsSince1970)])
39+
40+
print(dict)
41+
// {expiryTime = XXXX(秒)}, 并不是毫秒
4642
}
4743
struct Model: SmartCodableX {
48-
@SmartCompact.Array
49-
var ages: [Int] = []
50-
@SmartCompact.Array
51-
var frinds: [Frind] = []
52-
53-
@SmartCompact.Array
54-
var others: [Any] = []
44+
45+
var date: Date?
5546
}
5647

57-
struct Frind: SmartCodableX {
58-
var name: String = ""
59-
}
48+
6049
}
6150

6251

SmartCodable.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
Pod::Spec.new do |s|
1414
s.name = 'SmartCodable'
15-
s.version = '6.0.4'
15+
s.version = '6.0.5'
1616
s.summary = 'Swift数据解析库'
1717

1818
s.homepage = 'https://github.com/iAmMccc/SmartCodable'

Sources/SmartCodable/Core/JSONEncoder/SmartJSONEncoder.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ open class SmartJSONEncoder: JSONEncoder, @unchecked Sendable {
2424

2525
/// The options set on the top-level encoder.
2626
fileprivate var options: _Options {
27-
return _Options(dateEncodingStrategy: .secondsSince1970,
27+
return _Options(dateEncodingStrategy: dateEncodingStrategy,
2828
dataEncodingStrategy: smartDataEncodingStrategy,
2929
nonConformingFloatEncodingStrategy: nonConformingFloatEncodingStrategy,
3030
keyEncodingStrategy: smartKeyEncodingStrategy,

0 commit comments

Comments
 (0)