Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Alex Leffelman: Migrating to Realm on iOS
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
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
2k
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
仕様駆動開発へのトライを機に チームに適合する手法を模索し続けている話
freee
PRO
0
500
生成AIで帳票OCRが「簡単に」作れる時代になった?
kon_shou
0
890
運用ダッシュボードの設計を誰も教えてくれないのだけどみなさんどうしてるんですか? - チームに監視するという文化を根付かせるための第一歩を踏みたい -
satoshi256kbyte
1
120
ルールを書いて終わらせないハーネスエンジニアリング
yug1224
4
1.9k
2年かけて Deno に DOMMatrix を実装した話 / How I implemented DOMMatrix in Deno over two years
petamoriken
0
210
そこに3びきプロダクトがいるじゃろう——生成AI時代における“価値が届かない理由”の構造
kosuket
0
480
数百円から始めるRuby電子工作
tarosay
0
150
夏だ!祭りだ!祭りとはドメインモデリングでは?
ryugen04
0
280
型も通る、synthも通る、それでも危ない 〜AIのCDKの権限とコストを機械で検証する〜 / It Passes Type Checks, It Passes Synth Checks, but It’s Still Risky — Automatically Verifying Permissions and Costs in AI’s CDK —
seike460
PRO
1
550
わからない話を追いかけたら、プログラミング言語を作る側にいた
ydah
3
500
自動化したのに回らないテスト運用の壁ーAI時代の品質責任と生産性
mfunaki
0
130
170k Jobs a Day on GKE: Scaling Mercari's CI Platform - and What's Next for AI-Native Development
junyaokabe
0
110
Featured
See All Featured
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
3
430
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
480
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
430
Heart Work Chapter 1 - Part 1
lfama
PRO
8
36k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
470
BBQ
matthewcrist
89
10k
Amusing Abliteration
ianozsvald
1
250
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
Paper Plane
katiecoart
PRO
2
53k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
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?