alibaba / alibaba/HandyJSON

发现懒加载属性不能赋值。

Open
#188 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
4.3k
Forks
677
PR merge metrics
No merged PRs in 30d

Description

```swift
class MnlModel: HandyJSON {
lazy var advert = [[String: Any]]()
required init() {}
}
```

```swift
let dict = ["m_url": "http://m.meinali.com/ap_show-113.html",
"pid": 113,
"title": "俏佳人无痕美鼻免费案例征集——长沙雅美"]
if let model = MnlRecommendModel.deserialize(from: dict) {
print(model.advert)
// []
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running the MnlModel example with HandyJSON's deserialize(from:) entry point and confirm that the lazy advert property remains an empty array. Trace how deserialization discovers and assigns properties, then add a regression test showing the expected dictionary value is preserved for lazy properties.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.