Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Alex Leffelman: Migrating to Realm on iOS
Search
Realm
April 07, 2016
Programming
7.8k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Alex Leffelman: Migrating to Realm on iOS
Realm
April 07, 2016
More Decks by Realm
See All by Realm
WWDC 2017 Review
realm
0
2.2k
Xcode shortcuts
realm
0
4.8k
Self Branding with GitHub
realm
0
4.4k
Realm Mobile Platform overview and demo
realm
0
2.1k
Realm advanced topics and demo
realm
0
2.1k
Realm introduction Seoul meetup 10
realm
0
2.2k
Stuart Hall: How I got 2.3 Million App Downloads
realm
0
2k
James Majors: What the Swiftly Func?
realm
1
4.3k
Simina Pasat: Continuous everything for iOS apps
realm
0
670
Other Decks in Programming
See All in Programming
mrbgem 三角測量 開発
ogom
0
230
ジョジョの世界をXRで再現する
mofurune
0
150
wkhtmltopdfの次どうするか問題2026
willnet
2
1.9k
APNsからLive Activityを開始する話
yumnumm
0
160
HTML-in-Canvasで作る未来のWeb UI表現
clockmaker
3
4.2k
dotNET_vulnclicker_intro.pdf
deka_morita
0
140
SalesForceを内製化!? ~ HR事業を支える顧客管理基盤のインフラを大公開 ~
oku053
0
160
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
610
IBM Bob でAI駆動開発『QC-Playbook』
ichirokano2
0
110
AI主導のプログラミング学習アプリを作ってみた
econanringo
0
150
JRuby: Past, Present, and Future
headius
0
230
Vue Fes Japan 2026 タイムテーブル徹底解説
448jp
1
650
Featured
See All Featured
Ten Tips & Tricks for a 🌱 transition
stuffmc
1
260
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
33
5.2k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.7k
Marketing to machines
jonoalderson
1
5.9k
Tell your own story through comics
letsgokoyo
1
1.1k
Skip the Path - Find Your Career Trail
mkilby
1
250
Building AI with AI
inesmontani
PRO
1
1.3k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
1k
Rails Girls Zürich Keynote
gr2m
96
14k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.6k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
210
Transcript
Alex from Remind -
[email protected]
- @LeffelMania - remind.com/about
Try Before You Buy How to Test-Drive Realm Alongside Core
Data
Gearing Up for a Realm Migration
Why Choose?
Remind’s Starting Point - RestKit - AFNetworking 1.x - Complicated
RestKit mapping DSL - Mogenerator-generated model classes - Modular Remind stack on top of RestKit
Our Top Risk: Object Mapping into Realm - From-Scratch implementation
- Inconsistent JSON data - Type coercion
Server-Side Kill-Switch + Monitoring
Parallel Databases - Server is the only source of truth
- Hook into RestKit’s exit point - Map raw JSON into Realm database
Parallel Data Models: anti-DRY - User == RealmUser, Group ==
RealmGroup, etc - Determine migration lifetime early on
Integrating Initial UI Updates - Low-traffic, stable screens - Representative
of general patterns - How to accommodate both model types? - Replication vs. Conditional Logic
Interoperability @interface RLMObject (CoreDataMatching) + (NSString *)coreDataEntityName; - (NSPredicate *)coreDataMatchingPredicate;
- (id)coreDataEntity:(NSManagedObjectContext *)context; @end @interface NSManagedObject (RealmMatching) + (NSString *)realmEntityName; - (NSPredicate *)realmMatchingPredicate; - (id)realmEntity:(RLMRealm *)realm; @end
@implementation RLMObject (CoreDataMatching) - (NSPredicate *)coreDataMatchingPredicate { NSString *primaryKey =
[[self class] primaryKey]; id primaryValue = [self valueForKeyPath:primaryKey]; return [NSPredicate predicateWithFormat:@"%K == %@", primaryKey, primaryValue]; }
@implementation NSManagedObject (RealmMatching) - (__kindof RLMObject)realmEntity:(RLMRealm *)realm { NSString *entityName
= [[self class] realmEntityName]; Class entityClass = NSClassFromString(entityName); NSPredicate *predicate = [self realmMatchingPredicate]; RLMResults *results = [entityClass objectsInRealm:realm withPredicate:predicate]; return [results firstObject]; }
That’s It - Everything you need to migrate gradually.
Finishing the Job - What To Do/Not Do - With
high confidence, dive in - Have a plan - Don’t underestimate
None
Non-Obvious, Non-Trivial Migration Tasks - Network replacement? - Supplementing Realm
features - Unit Tests - Continuous integration - Code Review
Cutting Out Core Data - Press forward with Realm entities?
- Abandon Realm entities and migrate Core Data?
The Wrong Process, AKA, “The Hal” - Update one class’s
@interface to use Realm only. - Recurse every broken reference to that class - Follow the compiler until the build is green again
None
None
A Better Process(?) - 2 Steps Back = 100 Steps
Forward - Remove your Realm entities - Convert your Core Data entities directly
#winning
Recap: - You can roll out a Realm migration slowly
- Be safe out there - Don’t be an idiot like me - It’ll still take longer than you think
That’s it! Thanks, Realm! -
[email protected]
- @LeffelMania - remind.com/careers
- Questions?