Latest 0.1.0
Homepage https://github.com/SireAI/SireAutoNSCoding
License MIT
Platforms ios 8.0
Authors

CI Status
Version
License
Platform

==
If you like SwiftAutoNSCoding and use it, could you please:

star this repo

send me some feedback. Thanks!

Basic usage

Consider you have a object data like this:

import Foundation

class MallInfor: Store {
    var Code: String = "1"
    var ExceptionMsg: String = "对象序列化"
    var Msg: String = "成功"
    var RequestId: String = "33"
    var Result: SeckillListEntity?
    override var description: String {
        return "Code:(Code)  n" + "ExceptionMsg:(ExceptionMsg)  n" + "Msg:(Msg)  n" + "Result.BrandCountryLogo:(Result?.BrandCountryLogo)  n"
    }
}

class SeckillListEntity: Store {
    var BrandCountryLogo: String = "中国"
    var BuyNumber: Int = 2
    var CountryName: String? = "中国"
    var DisCount: Int = 3
    var Features: String? = "壮丽"
    var ImageNameFull: String? = "图片名称"
    var InStock: Bool = false
    var ItemCode: String? = "4444"
    var MarketPrice: String?
    var Name: String?
    var PromotionDescription: String?
    var PromotionPrice: String?
    var ShortName: String? = "华夏"
}

save data object to disk

        // raw data
        let oldInfor = MallInfor()
        // change some value
        oldInfor.Code = "100000"
        oldInfor.Msg = "what a new day"
        oldInfor.ExceptionMsg = "no error"
        oldInfor.Result = SeckillListEntity()
        oldInfor.Result!.BrandCountryLogo = "world china"

        // save to disk
        oldInfor.storeToDisk()

recover data from disk

   let newInfor = MallInfor.recoverFromDisk("(MallInfor.self)")

Attention

  • object must inherit Store

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

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

pod "SireAutoNSCoding", :git => 'https://github.com/SireAI/SwiftAutoNSCoding.git'

Author

Sire, [email protected]
Sire的博客

MyOther Projects

SireJSONModel

License

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

Latest podspec

{
    "name": "SireAutoNSCoding",
    "version": "0.1.0",
    "summary": "auto nscoding data and save data to disk or read from disk.",
    "homepage": "https://github.com/SireAI/SireAutoNSCoding",
    "license": "MIT",
    "authors": {
        "Sire": "[email protected]"
    },
    "source": {
        "git": "https://github.com/SireAI/SireAutoNSCoding.git",
        "tag": "0.1.0"
    },
    "social_media_url": "http://sireai.github.io/",
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "SireAutoNSCoding/Classes/**/*"
}

Pin It on Pinterest

Share This