LKCodingObject 1.4.1

LKCodingObject 1.4.1

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Dec 2017

Maintained by Hiroshi Hashiguchi.



  • By
  • Hiroshi Hashiguchi

Usage

Step 1 : Define subclass of LKCodingObject

#import "LKCodingObject.h"

@interface UserInfo : LKCodingObject
@property (strong, nonatomic) NSString* name;
@property (strong, nonatomic) NSString* email;
@end

Step 2 : Archive an instance of the class

UserInfo* userInfo = UserInfo.new;
userInfo.name = @"Hoge";
userInfo.email = @"[email protected]";
[NSKeyedArchiver archiveRootObject:userInfo toFile:@"user_info.dat"];

Step 3 : Unarchive from the file

UeserInfo* userInfo = [NSKeyedUnarchiver unarchiveObjectWithFile:@"user_info.dat"];

It is not necessary to implement NSCoding methods.

Notes

  • Properties must be conformed to NSCoding protocol.
  • If a property is not conforming to it, the property will not be archived.

Installation

Author

Hiroshi Hashiguchi, [email protected]

License

LKCodingObject is available under the MIT license. See the LICENSE file for more info.