• Stars
    star
    230
  • Rank 174,053 (Top 4 %)
  • Language
    Swift
  • License
    MIT License
  • Created over 8 years ago
  • Updated over 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Realm-powered Core Data persistent store

RealmIncrementalStore

Realm-powered Core Data persistent store

Wait, what?

I like Realm. Realm's memory-mapped DB blows other databases out of the water. It's fast and memory efficient.

I also like Core Data. (disclaimer: I'm the author of CoreStore.) It's a very stable ORM framework and it works on top of any persistent store.

Here's the kicker: Core Data is stuck with SQLite until a better lightweight DB comes along, and Realm's database engine is phenomenal but its Cocoa framework is still lacking some features.

Fortunately, Core Data's NSIncrementalStore interface lets us use the best of both worlds. RealmIncrementalStore is an NSIncrementalStore subclass that dynamically creates Realm schema using your Core Data models.

Here's an NSFetchedResultsController running on Realm back-end (right: Realm Browser):

Demo App and Realm Browser

(Check the RealmIncrementalStoreDemo to see how it works)

That said, this project is still in its prototype stages and is more of a proof-of-concept than a working product. Use at your own risk!

How to setup

Just include RealmIncrementalStore in your project and everything else is good old Core Data code. You just have to specify RealmIncrementalStore.storeType when calling addPersistentStoreWithType() on the NSPersistentStoreCoordinator:

let coordinator = NSPersistentStoreCoordinator(...)
do {
    
    try coordinator.addPersistentStoreWithType(
        RealmIncrementalStore.storeType, // here
        configuration: nil,
        URL: url,
        options: nil
    )
}
catch {
    
    // ...
}

Features

Right now, most of Core Data's functionality works:

  • Inserting / Updating / Deleting
  • Fetching
  • NSFetchedResultsControllers
  • Relationships
  • Basically most of what NSIncrementalStores were designed to work in

Missing bits / To Do

(Pull Requests are welcome!)

  • Relationships (in progress, halfway there) Done
  • Migrations
  • Fine-grained handling of NSFetchRequests
  • Optimizations (still waiting for the Realm folks to open-source the realm-core)
  • Try to implement NSPredicates that are not yet supported in Realm (?)
  • Benchmark!

Author

https://github.com/JohnEstropia

License

RealmIncrementalStore is released under an MIT license. See the LICENSE file for more information

More Repositories

1

swift-style-guide

Coding conventions and best practices for Swift projects
284
star
2

Animo

Bring life to CALayers with SpriteKit-like animation builders
Swift
282
star
3

AppVersionMonitor

Monitor iOS app version easily.
Swift
259
star
4

citrus

Fantastic animations and custom views for a good design
Java
238
star
5

Storybook-ios

UI Component previewer for UI development faster in iOS (Currently supports only UIKit)
Swift
190
star
6

ScrollEdgeControl

♻️ Replacement of UIRefreshControl, and more functions.
Swift
57
star
7

kamimai

🧻 紙舞 - Kamimai is a migration manager written in Go
Go
46
star
8

traveling

Kotlin
24
star
9

AssetsPicker

🏞The UI library to pick PHAsset
Swift
14
star
10

RSS-Swift

Swift
11
star
11

FlatStore

[Experimental] FlatStore is a memory-only data storage library written at Eureka
Swift
10
star
12

appsflyer

AppsFlyer API client library for Go.
Go
8
star
13

bobo

Slack Bot Kit for Golang
Go
8
star
14

Tower

🗼 Watching git branches, the new commits on each branch run scripts.
Swift
8
star
15

SpringFlowLayoutExample

Swift
7
star
16

slslog

CW Logs Insight で trace で一連の処理を追うことのできる Logger です。
Go
5
star
17

pairs-web-card-example

Web Front-end Team, Pairsのインターン選考の技術課題の回答例
JavaScript
3
star
18

example-blog-golang

example codes for blog article
Go
2
star
19

cafe-bot

Slack bot for Archimedes Cafe
Go
1
star
20

PushTower

🗼 Dispatch Remote Push Notification Packages [Core <- Server | DesktopApp]
Objective-C
1
star
21

bobo-googlehome

Google Home Commands and Tasks for eure/bobo (Slackbot)
Go
1
star