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
Realm Japan meetup #11
Search
Kishikawa Katsumi
July 24, 2016
Programming
0
210
Realm Japan meetup #11
Realmのアーキテクチャ
- 遅延ロード・ゼロコピーの図解
- クエリがどのように実行されるか
Kishikawa Katsumi
July 24, 2016
Tweet
Share
More Decks by Kishikawa Katsumi
See All by Kishikawa Katsumi
iOSDC 2024 SMBファイル共有をSwiftで実装する
kishikawakatsumi
1
180
Enhancing Applications with Accessibility API
kishikawakatsumi
3
3.4k
Mastering SwiftSyntax
kishikawakatsumi
4
5.5k
My SwiftData Review
kishikawakatsumi
7
1.4k
Swift Expression Macros: a practical introduction
kishikawakatsumi
3
1.9k
Xcode Cloudの評価
kishikawakatsumi
2
1.3k
Regular expressions basics/正規表現の基本
kishikawakatsumi
7
730
家のいろいろな数値を計測する
kishikawakatsumi
4
2.2k
GitHub Actionsでテストの結果をわかりやすく表示する
kishikawakatsumi
1
1.1k
Other Decks in Programming
See All in Programming
KMP와 kotlinx.rpc로 서버와 클라이언트 동기화
kwakeuijin
0
240
CloudflareStack でRAGに入門
asahiiwm
0
130
競技プログラミングへのお誘い@阪大BOOSTセミナー
kotamanegi
0
370
為你自己學 Python
eddie
0
370
Effective Signals in Angular 19+: Rules and Helpers
manfredsteyer
PRO
0
180
テストケースの名前はどうつけるべきか?
orgachem
PRO
0
160
20年もののレガシープロダクトに 0からPHPStanを入れるまで / phpcon2024
hirobe1999
0
890
Асинхронность неизбежна: как мы проектировали сервис уведомлений
lamodatech
0
1.1k
Fibonacci Function Gallery - Part 1
philipschwarz
PRO
0
250
Kaigi on Railsに初参加したら、その日にLT登壇が決定した件について
tama50505
0
120
Stackless и stackful? Корутины и асинхронность в Go
lamodatech
0
1.1k
情報漏洩させないための設計
kubotak
4
1.1k
Featured
See All Featured
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
Fireside Chat
paigeccino
34
3.1k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.9k
Why Our Code Smells
bkeepers
PRO
335
57k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
29
2k
Being A Developer After 40
akosma
89
590k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
7
530
Automating Front-end Workflow
addyosmani
1366
200k
Visualization
eitanlees
146
15k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Reflections from 52 weeks, 52 projects
jeffersonlam
347
20k
Transcript
Realm Japan Meetup #11
#realm_jp
https://github.com/kishikawakatsumi/ kishikawa katsumi http://kishikawakatsumi.hatenablog.com/ Realm
Realm Objective-C/Swift 0.97.1 ˖ 'JYDSBTIFTXIFOBO3-.3FBMNJTEFBMMPDBUFEGSPNUIF XSPOHUISFBE ˖ *OEFYJOH#00-#PPMBOE/4%BUFQSPQFSUJFTBSFOPX TVQQPSUFE ˖
4XJGU"EETVQQPSUGPSJOEFYJOHPQUJPOBMQSPQFSUJFT
Realm Objective-C/Swift 0.98.0ʢ༧ఆʣ ˖ "TZOD2VFSJFT
Realm Objective-C/Swift 0.99.0ʢ༧ఆʣ ˖ 'JOFHSBJOFE/PUJDBUJPO
RealmͷԆϩʔυΛ׆༻͢Δʹ
Realmͷجຊతͳ͍ํ
class Article: Object { dynamic var id: Int = 0
dynamic var title: String = "" dynamic var content: String = "" dynamic var creationDate: NSDate = NSDate() dynamic var modificationDate: NSDate = NSDate() dynamic var deletionDate: NSDate? = nil dynamic var user: User? = nil let comments = List<Comment>() override static func primaryKey() -> String? { return "id" } } class Comment: Object { dynamic var id: Int = 0 dynamic var content: String = "" dynamic var user: User? = nil override static func primaryKey() -> String? { return "id" } } class User: Object { dynamic var id: Int = 0 dynamic var name: String = "" override static func primaryKey() -> String? { return "id" } }
let realm = try! Realm() let article = Article() article.title
= titleTextfield.text article.contents = contentTextfield.text let currentUser = realm.objectForPrimaryKey(User.self, key: userID) article.user = currentUser try! realm.write { in realm.add(article) }
let realm = try! Realm() let articles = realm.objects(Article).filter("user =
%@", currentUser) let article = articles[0]
let realm = try! Realm() let currentUser = realm.objectForPrimaryKey(User.self, key:
userID) try! realm.write { in currentUser.name = "..." }
ԆϩʔυΛ׆༻͢Δ
override func viewDidLoad() { ... articles = realm.objects(Article).filter("user = %@",
currentUser) } override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return articles.count } override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCellWithIdentifier("", forIndexPath: indexPath) let article = articles[indexPath.row] cell.title = article.title cell.content = article.content cell.username = article.user.name return cell }
ԆϩʔυͷΈ
ԆϩʔυͷΈ articles = realm.objects(Article).filter("user = %@", currentUser)
ԆϩʔυͷΈ articles = realm.objects(Article) .filter("user = %@", currentUser)
ԆϩʔυͷΈ let allArticles = realm.objects(Article) let articles = allArticles.filter(“user =
%@", currentUser)
ԆϩʔυͷΈ let allArticles = realm.objects(Article) let articles = allArticles.filter(“user =
%@", currentUser) 3FTVMUT"SUJDMF 5BCMF"SUJDMF
ඇಉظΫΤϦ (Swift) let allArticles = realm.objects(Article) let articles = allArticles.filter(“user
= %@", currentUser) 3FTVMUT"SUJDMF 5BCMF"SUJDMF 3FTVMUT"SUJDMF 5BCMF"SUJDMF 2VFSZVTFS
ඇಉظΫΤϦ (Swift) let articles = allArticles.filter(“user = %@", currentUser) let
count = articles.count 3FTVMUT"SUJDMF 5BCMF"SUJDMF 2VFSZVTFS 3FTVMUT"SUJDMF 5BCMF"SUJDMF 2VFSZVTFS $PVOU 7JFX
ඇಉظΫΤϦ (Swift) let count = articles.count let article = articles[0]
3FTVMUT"SUJDMF 5BCMF"SUJDMF 2VFSZVTFS $PVOU 7JFX "SUJDMF 3PX*OEFY 3FTVMUT"SUJDMF 5BCMF"SUJDMF 2VFSZVTFS $PVOU 7JFX
ඇಉظΫΤϦ (Swift) let article = articles[0] let title = article.title
"SUJDMF 3PX*OEFY 3FTVMUT"SUJDMF 5BCMF"SUJDMF 2VFSZVTFS $PVOU 7JFX "SUJDMF 3PX*OEFY 5JUMF(FUUFS 3FBMN 4USJOH 5JUMF
None
IUUQTUFDICPPTUFSCPPUIQN
Where to find us • # Realm Japan User Group:
facebook.com/groups/realmjp • # Twitter: twitter.com/realmJapan • GitHub: github.com/realm • # StackOverflow: ja.stackoverflow.com/questions/tagged/realm • # Email:
[email protected]
• # Slack: slack.realm.io/
Realm Japan User Group # facebook.com/groups/realmjp
Public Realm Slack # slack.realm.io/
Official Twitter/Facebook twitter.com/realm facebook.com/655569387879379
Official Web site # realm.io/jp
Next Realm Meetup
http://bit.ly/RealmJP_11 ͍Ξϯέʔτʹ͝ڠྗ͍ͩ͘͞