Skip to content

Commit 09a5379

Browse files
committed
Remove uncessary file
1 parent 528c6b7 commit 09a5379

File tree

4 files changed

+20
-164
lines changed

4 files changed

+20
-164
lines changed

KakaJSON/Global/KakaJSON.swift

Lines changed: 0 additions & 162 deletions
This file was deleted.

KakaJSON/Metadata/Property.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
public class Property: CustomStringConvertible {
1111
public let name: String
1212
public let type: Any.Type
13-
public private(set) var dataType: Any.Type = Any.self
13+
public private(set) lazy var dataType: Any.Type = type~!
1414
public let isVar: Bool
1515
public let offset: Int
1616
public let ownerType: Any.Type
@@ -23,7 +23,6 @@ public class Property: CustomStringConvertible {
2323
self.isVar = isVar
2424
self.offset = offset
2525
self.ownerType = ownerType
26-
self.dataType = type~!
2726
}
2827

2928
func set(_ value: Any, for model: UnsafeMutableRawPointer) {

KakaJSONTests/JSON_To_Model/JTM_03_NestedModel.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,22 @@ class JTM_03_NestedModel: XCTestCase {
7373
XCTAssert(person?.dogs?["dog1"]?.age == dogs[1].age)
7474
}
7575

76+
func testRecursive() {
77+
class Person: Convertible {
78+
var name: String = ""
79+
var parent: Person?
80+
required init() {}
81+
}
82+
83+
let json: [String: Any] = [
84+
"name": "Jack",
85+
"parent": ["name": "Jim"]
86+
]
87+
88+
let person = json.kj.model(Person.self)
89+
XCTAssert(person?.name == "Jack")
90+
XCTAssert(person?.parent?.name == "Jim")
91+
}
7692

7793
func testOptional() {
7894
struct Book: Convertible {

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ Or you can login Xcode with your GitHub account. just search **KakaJSON**.
102102
## Coding
103103

104104
```swift
105+
// file path (can be String or URL)
106+
let file = "/Users/mj/Desktop/test.data"
107+
105108
/****************** String ******************/
106109
let string1 = "123"
107110
// wrtite String to file

0 commit comments

Comments
 (0)