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
Share Data Across Extension and App with Realm
Search
Kishikawa Katsumi
May 14, 2015
Programming
1
2.8k
Share Data Across Extension and App with Realm
Share Data Across Extension and App with Realm
Kishikawa Katsumi
May 14, 2015
Tweet
Share
More Decks by Kishikawa Katsumi
See All by Kishikawa Katsumi
iOSDC 2024 SMBファイル共有をSwiftで実装する
kishikawakatsumi
1
160
Enhancing Applications with Accessibility API
kishikawakatsumi
3
3.2k
Mastering SwiftSyntax
kishikawakatsumi
4
5.3k
My SwiftData Review
kishikawakatsumi
7
1.4k
Swift Expression Macros: a practical introduction
kishikawakatsumi
3
1.8k
Xcode Cloudの評価
kishikawakatsumi
2
1.2k
Regular expressions basics/正規表現の基本
kishikawakatsumi
7
720
家のいろいろな数値を計測する
kishikawakatsumi
4
2.2k
GitHub Actionsでテストの結果をわかりやすく表示する
kishikawakatsumi
1
1k
Other Decks in Programming
See All in Programming
Outline View in SwiftUI
1024jp
1
330
RubyLSPのマルチバイト文字対応
notfounds
0
120
Macとオーディオ再生 2024/11/02
yusukeito
0
370
카카오페이는 어떻게 수천만 결제를 처리할까? 우아한 결제 분산락 노하우
kakao
PRO
0
110
Tauriでネイティブアプリを作りたい
tsucchinoko
0
370
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
9
3.3k
Jakarta EE meets AI
ivargrimstad
0
560
Flutterを言い訳にしない!アプリの使い心地改善テクニック5選🔥
kno3a87
1
180
Streams APIとTCPフロー制御 / Web Streams API and TCP flow control
tasshi
2
350
CSC509 Lecture 13
javiergs
PRO
0
110
2024/11/8 関西Kaggler会 2024 #3 / Kaggle Kernel で Gemma 2 × vLLM を動かす。
kohecchi
5
920
Quine, Polyglot, 良いコード
qnighy
4
640
Featured
See All Featured
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
Testing 201, or: Great Expectations
jmmastey
38
7.1k
Adopting Sorbet at Scale
ufuk
73
9.1k
Being A Developer After 40
akosma
86
590k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.8k
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
Unsuck your backbone
ammeep
668
57k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
Optimizing for Happiness
mojombo
376
70k
RailsConf 2023
tenderlove
29
900
Transcript
Share Data Across Extension and App with Realm
http://kishikawakatsumi.com kishikawa katsumi https://github.com/kishikawakatsumi
App Group
App Group
Realm
NSFileManager *fileManager = [[NSFileManager alloc] init]; NSURL *containerURL = [fileManager
containerURLForSecurityApplicationGroupIdentifier:@"group.com.xxx.realm"]; NSString *containerPath = [containerURL URLByAppendingPathComponent:@"test.realm"].path; [RLMRealm setDefaultRealmPath:containerPath]; RLMRealm *realm = [RLMRealm defaultRealm]; [realm transactionWithBlock:^{ NSString *text = ...; __block NSUInteger identifier = 0; [text enumerateLinesUsingBlock:^(NSString *line, BOOL *stop) { Address *address = [[Address alloc] init]; address.address = line; [realm addObject:address]; }]; }];
Memory Usage Limitations on App Extension
24MB?
Ұ෦ͷσʔλ͚ͩڞ༗͢Δ
RLMRealm *realm = [RLMRealm defaultRealm]; [realm transactionWithBlock:^{ NSString *text =
...; __block NSUInteger identifier = 0; [text enumerateLinesUsingBlock:^(NSString *line, BOOL *stop) { Address *address = [[Address alloc] init]; address.address = line; [realm addObject:address]; }]; }]; NSFileManager *fileManager = [[NSFileManager alloc] init]; NSURL *containerURL = [fileManager containerURLForSecurityApplicationGroupIdentifier:@"group.com.xxx.realm"]; NSString *containerPath = [containerURL URLByAppendingPathComponent:@"test.realm"].path; RLMRealm *sharedRealm = [RLMRealm realmWithPath:containerPath]; [sharedRealm transactionWithBlock:^{ for (int i = 0; i < 10; i++) { Address *address = addresses[i]; Address *clone = [[Address alloc] initWithValue:address]; [sharedRealm addObject:clone]; } }];