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
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
Ethereum_.pdf
nekomatu
0
460
型付き API リクエストを実現するいくつかの手法とその選択 / Typed API Request
euxn23
8
2.2k
subpath importsで始めるモック生活
10tera
0
300
Remix on Hono on Cloudflare Workers
yusukebe
1
290
ヤプリ新卒SREの オンボーディング
masaki12
0
130
Compose 1.7のTextFieldはPOBox Plusで日本語変換できない
tomoya0x00
0
190
初めてDefinitelyTypedにPRを出した話
syumai
0
410
Creating a Free Video Ad Network on the Edge
mizoguchicoji
0
120
Macとオーディオ再生 2024/11/02
yusukeito
0
370
AWS Lambdaから始まった Serverlessの「熱」とキャリアパス / It started with AWS Lambda Serverless “fever” and career path
seike460
PRO
1
260
『ドメイン駆動設計をはじめよう』のモデリングアプローチ
masuda220
PRO
8
540
Click-free releases & the making of a CLI app
oheyadam
2
110
Featured
See All Featured
How to Think Like a Performance Engineer
csswizardry
20
1.1k
Fireside Chat
paigeccino
34
3k
Agile that works and the tools we love
rasmusluckow
327
21k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
4
370
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
What's in a price? How to price your products and services
michaelherold
243
12k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Producing Creativity
orderedlist
PRO
341
39k
For a Future-Friendly Web
brad_frost
175
9.4k
Documentation Writing (for coders)
carmenintech
65
4.4k
Building an army of robots
kneath
302
43k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
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 ͍Ξϯέʔτʹ͝ڠྗ͍ͩ͘͞