CoreData management library written in Swift
Clone or download
Pull request Compare This branch is 1 commit ahead, 453 commits behind modo-studio:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
example
library
project
resources
spec
.cocoadocs.yml
.gitignore
.travis.yml
Gemfile
Gemfile.lock
LICENSE
Podfile
README.md
Rakefile
SugarRecord.podspec
ci.sh

README.md

xcres

![Gitter](https://badges.gitter.im/Join Chat.svg)

Twitter: @pepibumur Language: Swift Build Status Language: Swift Issues Forks Stars

What is SugarRecord?

SugarRecord is a management library to make it easier work with CoreData and REALM. Thanks to SugarRecord you'll be able to start working with CoreData/REALM with just a few lines of code:

  1. Choose your preferred stack among the available ones (You can even propose your own!)
  2. Enjoy with your database operations

The library is completely written in Swift and fully tested to ensure it behaves as expected.

There's a Google Group where you can leave your topics, question, doubts, suggestions and stuff besides issues https://groups.google.com/forum/#!forum/sugarrecord .

Powered by @pepibumur with the help of @isaacroldan, @rdougan and some developers

The scheme above shows the structure of SugarRecord. It's formed by:

  • Database Models Extensions: To add the sugar syntax that links these models with SugarRecord and the database.
  • Finder: SugarRecord custom element to abstract the querying components from the type of storage (Realm or CoreData)
  • Core: Main component of the library that translates Save/Delete/Find calls into internal operations using the stacks set.
  • SugarRecord contexts: Altough Realm doesn't have contexts as we have in CoreData, we have created abstracted contexts that surround the user operations with models independently if you are using CoreData or Realm. Yeah!
  • Stack: The storage stack is another key piece in SugarRecord because it knows how and when persist/fetch/delete your objects into the database. You can tell SugarRecord which stack it should use.

Mailing list

If you want to stay updated we have a mailing list. We'll send emails with new updates, features, important bugs fixed, ...

image

Updates

Date Done
8th-January-2015 Fixed Travis-CI Integration
8th-January-2015 Finally added CocoaPods support and updated the Wiki
3st-January-2015 Solved issue https://github.com/SugarRecord/SugarRecord/issues/101
29th-December-2014 Version 1.0.5 released
29th-December-2014 Separated SugarRecordResults Logic https://github.com/SugarRecord/SugarRecord/issues/98
25th-December-2014 Version 1.0.4 released
25th-December-2014 Added Realm example
25th-December-2014 Added a continuous integration local script
25th-December-2014 Updated Realm to 0.89
25th-December-2014 Setup SugaRecord.podspec file

Index

Features

  • For beginners and advanced users
  • Fully customizable. Implement your own stack and set it as your SugarRecord stack to work with.
  • Friendly syntax. Forget about NSPredicates and NSSortDescriptors
  • You can change between different stacks without affecting to the rest of your app.
  • In case of a transition from CoreData to Realm or viceversa you've only to ensure the objecs have the same property names, and nothing more.
  • Background operations are automatically managed by Sugar Record
  • Support for Realm and CoreData using the same syntax
  • Multiple stacks (for Realm, CoreData, CoreData+iCloud)
  • Sugar syntax, forget about complicated lines of code to fetch your last 20 users!
  • Written 100% in Swift and compatible with Swift projects (in case of Objective-C a wrapper is needed)
  • Compatible with OSX and iOS
  • Fully documented with a playground tutorial and an updated Wiki page
  • Fully tested (all components are tested using XCTest)
  • Actively supported, issues covered in less than a week.
  • More powerful features to discover!

Versions

Version 1.0.7 [WIP]

Version 1.0.6

  • Fixed autosaving feature on DefaultCDStack
  • Use of printable instead of StringLiteralConvertible
  • Reviewed the CI script (still not working travis :( )

Version 1.0.5

Version 1.0.4

  • Updated the project structure and added easy setup steps (without CocoaPods)
  • Added example project
  • Added high performance count method
  • Added SugarRecordResults type for results (inspired on RLMResults)

Requirements

  • Xcode 6
  • iOS 7.0+ / Mac OS X 10.9+
  • If you have troubles with the compilation try to clean the DerivedData Xcode directory: rm -rf ~/Library/Developer/Xcode/DerivedData/

Wiki

If you want to know about how to use SugarRecord we have some Wiki pages in the repo to guide you through the integration in your project. Availble Wiki pages are:

  • About SugarRecord: Link
  • Setup SugarRecord: Link
  • Working with Stacks: Link
  • Operations: Link
  • Advanced operations with SugarRecord: Link
  • Mapping models: Link
  • Advices: Link
  • Contribution tips: Link

Support

If you want to communicate any issue, suggestion or even make a contribution, you have to keep in mind the flow bellow:

  • If you need help, ask your doubt in Stack Overflow using the tag 'sugarrecord'
  • If you want to ask something in general, use Stack Overflow too.
  • Open an issue either when you have an error to report or a feature request.
  • If you want to contribute, submit a pull request, and remember the rules to follow related with the code style, testing, ...

Useful Swift Resources

License

The MIT License (MIT)

Copyright (c) <2014> <Pedro Piñera>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Who uses SugarRecord?

If you are currently using SugarRecord in your app, let me know and I'll add it to the list.

Donations

SugarRecord is almost completely the work of one man: me; Pedro Pinñera. I thoroughly enjoyed making SugarRecord, but nevertheless if you have found it useful then your bitcoin will give me a warm fuzzy feeling from my head right down to my toes Donate Bitcoins<script src="https://www.coinbase.com/assets/button.js" type="text/javascript"></script>