Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add property copy and customize encoding/decoding methods #516

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Roen-Ro
Copy link

@Roen-Ro Roen-Ro commented Dec 24, 2018

  1. 给YYModel添加了自定义 encode/decode方法
-(BOOL)shouldCustomEncodeValueForKey:(NSString *)propertyKey withCoder:(NSCoder *)aCoder;
-(BOOL)shouldCustomDecodeValueForKey:(NSString *)propertyKey withCoder:(NSCoder *)aDecoder;

程序员可以在子类重写这两个方法来自定义一些属性的encode/decode,比如一些struct结构体,或者做一些历史版本数据的兼容,就很必要用到这两个方法。

  1. 给YYModel添加了从其他对象拷贝属性的方法
    添加的方法:
-(void)copyPropertiesFromSourceObject:(id)sourceObj

通过这个方法将一个对象A的属性全部拷贝到已有的对象B上,而不需要新建创建对象

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant