-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Pedro Piñera Buendía
committed
Apr 7, 2017
1 parent
c82e510
commit 3049419
Showing
13 changed files
with
7 additions
and
1,220 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
80 changes: 0 additions & 80 deletions
80
Carthage.xcodeproj/xcshareddata/xcschemes/iOSRealm.xcscheme
This file was deleted.
Oops, something went wrong.
80 changes: 0 additions & 80 deletions
80
Carthage.xcodeproj/xcshareddata/xcschemes/macOSRealm.xcscheme
This file was deleted.
Oops, something went wrong.
80 changes: 0 additions & 80 deletions
80
Carthage.xcodeproj/xcshareddata/xcschemes/tvOSRealm.xcscheme
This file was deleted.
Oops, something went wrong.
80 changes: 0 additions & 80 deletions
80
Carthage.xcodeproj/xcshareddata/xcschemes/watchOSRealm.xcscheme
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
[](https://github.com/Carthage/Carthage) | ||
|
||
## What is SugarRecord? | ||
SugarRecord is a persistence wrapper designed to make working with persistence solutions like CoreData/Realm/... in a much easier way. Thanks to SugarRecord you'll be able to use CoreData with just a few lines of code: Just choose your stack and start playing with your data. | ||
SugarRecord is a persistence wrapper designed to make working with persistence solutions like CoreData in a much easier way. Thanks to SugarRecord you'll be able to use CoreData with just a few lines of code: Just choose your stack and start playing with your data. | ||
|
||
The library is maintained by [@carambalabs](https://github.com/carambalabs). You can reach me at [[email protected]](mailto://[email protected]) for help or whatever you need to commend about the library. | ||
|
||
|
@@ -43,7 +43,6 @@ Choose the right one depending ton the configuration you need for you app. | |
```ruby | ||
pod "SugarRecord/CoreData" | ||
pod "SugarRecord/CoreData+iCloud" | ||
pod "SugarRecord/Realm" | ||
``` | ||
|
||
### [Carthage](https://github.com/carthage) | ||
|
@@ -53,8 +52,6 @@ pod "SugarRecord/Realm" | |
3. Execute `carthage update` | ||
4. Add the frameworks to your project as explained on the [Carthage repository](https://github.com/carthage). | ||
|
||
> Note: If you use the [Realm](https://realm.io) you have to also add `Realm.framework` and `RealmSwift.framework`. | ||
### Reactive programming | ||
|
||
We provide extensions for SugarRecord that offer a reactive interface to the library: | ||
|
@@ -68,7 +65,7 @@ You can check generated SugarRecord documentation [here](http://cocoadocs.org/do | |
# How to use | ||
|
||
#### Creating your Storage | ||
A storage represents your database, Realm, or CoreData. The first step to start using SugarRecord is initializing the storage. SugarRecord provides two default storages, one for CoreData, `CoreDataDefaultStorage` and another one for Realm, `RealmDefaultStorage`. | ||
A storage represents your database. The first step to start using SugarRecord is initializing the storage. SugarRecord provides a default storages, `CoreDataDefaultStorage`. | ||
|
||
```swift | ||
// Initializing CoreDataDefaultStorage | ||
|
@@ -79,11 +76,6 @@ func coreDataStorage() -> CoreDataDefaultStorage { | |
let defaultStorage = try! CoreDataDefaultStorage(store: store, model: model) | ||
return defaultStorage | ||
} | ||
|
||
// Initializing RealmDefaultStorage | ||
func realmStorage() -> RealmDefaultStorage { | ||
return RealmDefaultStorage() | ||
} | ||
``` | ||
|
||
##### Creating an iCloud Storage | ||
|
@@ -101,7 +93,7 @@ func icloudStorage() -> CoreDataiCloudStorage { | |
``` | ||
|
||
#### Contexts | ||
Storages offer multiple kind of contexts that are the entry points to the database. For curious developers, in case of CoreData a context is a wrapper around `NSManagedObjectContext`, in case of Realm a wrapper around `Realm`. The available contexts are: | ||
Storages offer multiple kind of contexts that are the entry points to the database. For curious developers, in case of CoreData a context is a wrapper around `NSManagedObjectContext`. The available contexts are: | ||
|
||
- **MainContext:** Use it for main thread operations, for example fetches whose data will be presented in the UI. | ||
- **SaveContext:** Use this context for background operations. The context is initialized when the storage instance is created. That context is used for storage operations. | ||
|
@@ -186,11 +178,11 @@ do { | |
``` | ||
|
||
<br> | ||
> This is the first approach of SugarRecord for the interface. We'll improve it with the feedback you can report and according to the use of the framework. Do not hesitate to reach us with your proposals. Everything that has to be with making the use of CoreData/Realm easier, funnier, and enjoyable is welcome! :tada: | ||
> This is the first approach of SugarRecord for the interface. We'll improve it with the feedback you can report and according to the use of the framework. Do not hesitate to reach us with your proposals. Everything that has to be with making the use of CoreData easier, funnier, and enjoyable is welcome! :tada: | ||
### RequestObservable | ||
|
||
SugarRecord provides a component, `RequestObservable` that allows observing changes in the DataBase. It uses Realm notifications and CoreData `NSFetchedResultsController` under the hood. | ||
SugarRecord provides a component, `RequestObservable` that allows observing changes in the DataBase. It uses `NSFetchedResultsController` under the hood. | ||
|
||
**Observing** | ||
|
||
|
Oops, something went wrong.