Latest 1.3.1
Homepage https://github.com/lakesoft/LKArchiver
License MIT
Platforms ios 7.0, requires ARC
Authors

NSKeyedArchiver/NSKeyedUnArchiver wrapper

Usage

Archiving

[LKDocumentDirectoryArchiver archiveRootObject:userList
                                        forKey:@"UserList"];

It executes like below functions.

// filename is equal to (Application Directory)/Documents/UserList.archive
[NSKeyedArchiver archiveRootObject:userList toFile:filename];

Unarchiving

id userList = [LKDocumentDirectoryArchiver unarchiverObjectForKey:@"UserList"];

It executes like below functions.

id userList = [NSKeyedUnarchiver unarchiverObjectWithFile:filename];

If required default value case,

[LKDocumentDirectoryArchiver unarchiveObject:userList
                                      forKey:@"UserList"
                                defaultObject:^id{
                                   return @[].mutableCopy;
                                }];

Supports handling failure,

[LKDocumentDirectoryArchiver unarchiveObject:userList
                                      forKey:@"UserList"
                                     failure:^{
                                        // do something
                                     }];

Using directroy

You can use directory.

[LKDocumentDirectoryArchiver archiveRootObject:userList1
                                        forKey:@"Support/01/UserList"];
// placed as bellow:
// (Application Directory)/Documents/Support/01/UserList.archive

The first "/" character will be removed. (e.g.) "/Sales/obj" => "Sales/obj"

Etc

You can remove an archive file.

[LKDOcumentDirectoryArchiver removeArchiverForKey:@"UserList"];

Check to exist an archiver file.

[LKDocumentDirectoryArchiver archiverExistsForKey:@"UserList"];

NSCachesDirectory is available too:

[LKCachesDirecotryArchiver archiveRootObject:userList toFile:filename];

Installation

LKUserDefaults is available through CocoaPods, to install
it simply add the following line to your Podfile:

pod "LKArchiver"

Author

Hiroshi Hashiguchi, [email protected]

License

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

Latest podspec

{
    "name": "LKArchiver",
    "version": "1.3.1",
    "summary": "NSKeyedArchiver/NSKeyedUnArchiver wrapper",
    "description": "NSKeyedArchiver/NSKeyedUnArchiver wrapper.n",
    "homepage": "https://github.com/lakesoft/LKArchiver",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Hiroshi Hashiguchi": "xca[email protected]"
    },
    "source": {
        "git": "https://github.com/lakesoft/LKArchiver.git",
        "tag": "1.3.1"
    },
    "platforms": {
        "ios": "7.0"
    },
    "requires_arc": true,
    "source_files": "Classes/*"
}

Pin It on Pinterest

Share This