alibaba / alibaba/HandyJSON

如何在数据模型内部,进行update?

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

Description

如题

class UserAccount: HandyJSON {
required init() {
super.init()
let json = "{/"id/":/"1/"}"
// 在对象内部进行自我update, 类似于 YYModel的 self.yy_modelSet(withJSON: dict)
// Cannot pass immutable value as inout argument: 'self' is immutable 报错
JSONDeserializer.update(object: &self, from: dict)
}
}

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading JSONDeserializer.update and the UserAccount initializer shown in the issue, then reproduce the reported immutable-self error. The issue does not name a source file or test; done would require a clearly supported answer or behavior for updating an object from inside its own initializer, with the limitation documented or tested.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.