Git Product home page Git Product logo

wzlserializekit's Introduction

WZLSerializeKit

iOS serialization in 1 line. 1行代码完成iOS序列化与反序列化,本文件提供iOS下的序列化与反序列集成方案。

本文件提供iOS下的序列化与反序列集成方案,封装后用一行代码即可轻松实现。 在传统方式中当你需要对某个对象进行序列化与反序列化时,往往需要实现协议以及协议(非必须), 在协议方法中对需要序列化的变量执行encode&decode操作。当变量较多并且需要序列化的自定义对象较多时容易出现过多冗余代码,稍有不慎容易出错。 WZLSerializeKit在运行时对类以及所有层级父类的变量进行遍历,避免遗漏。属性越多,优势越明显。

Usage:

 Person.h:
 ========================================
#import "WZLSerializeKit.h"

@interface Person: SomeSuperclass<NSCoding, NSCopying>
{
	...
}

@end
========================================


 Person.m:
========================================
#import "Person.h"

@implementation Person

WZLSERIALIZE_CODER_DECODER();
WZLSERIALIZE_COPY_WITH_ZONE();
WZLSERIALIZE_DESCRIPTION();//(NOT NECESSARY)

@end
========================================

at the place where you want to serialize Person instance: eg:

//archive object to NSData
WZLSERIALIZE_ARCHIVE(person, @"Person", [self filePath]);
//unarchive NSData to object
Person  thePerson = nil;
WZLSERIALIZE_UNARCHIVE(thePerson, @"Person", [self filePath]);

wzlserializekit's People

Contributors

weng1250 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.