Skip to content

add property copy and customize encoding/decoding methods#516

Open
Roen-Ro wants to merge 1 commit intoibireme:masterfrom
Roen-Ro:master
Open

add property copy and customize encoding/decoding methods#516
Roen-Ro wants to merge 1 commit intoibireme:masterfrom
Roen-Ro:master

Conversation

@Roen-Ro
Copy link
Copy Markdown

@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.

1 participant