Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

README.md

ObjectStorage

CocoaPods Build Status

ObjectStorage is a framework that make CRUD works on your model entities, you may choose what storage you want e.g. Sqlite, CoreData, plist...

Current Support

  • CoreData
  • Sqlite
  • UserDefaults
  • Keychains
  • File

How to use

Best thing to do is have a look at ObjectStorageTests.

  1. Make your model conform to Model protocol, I suggest you create a base class for that, take a look at MappableModel in ObjectStorageTests folder.
class UserProfile: Model
Most import for CoreData is set up your ModelIdentifier in your model.
public typealias ModelIdentifier = (modelName: String, keys: [String], values: [String?])
modelName is the CoreData model name, keys and values will use for CoreData queries.
  1. Create StorageProviderService instance
let storageProvider = StorageProviderService(coreDataModelFileName: "Model")
  1. Then CRUD your model
let profile = UserProfile(firstName: 'Jiantang', lastName: 'Li')
storageProvider.create(profile)
storageProvider.update(profile)
let read = storageProvider.read(profile)
storageProvider.delete(profile)

CocoaPods

ObjectStorage's already taken, so I use 'LiObjectStorage' instead.

pod 'LiObjectStorage', '~> 0.1.1'

Carthage

github "tonyli508/ObjectStorage", "~> 0.1.1"

TODOs

  • Simplify Model Protocol.
  • More storage support.
  • Add more complex testings.
  • Carthage support.

About

ObjectStorage is a framework written in Swift for CRUD your model entities, you may choose what type of storage you want e.g. Sqlite, CoreData, plist...

Topics

Resources

License

Packages

No packages published
You can’t perform that action at this time.