Slide 1

Slide 1 text

Craft Collaborative Apps with Marius RACKWITZ @mrackwitz [email protected] realm ، ف ٔ ׾ ⡲ ׷ ؝ ٓ ن ٖ խ ء ّ ٝ ׾ ⢪ ׏ ג ٦

Slide 2

Slide 2 text

What is a collaborative app? ؝ٓنٖ٦ءّٝ،فٔהכ 
 ? [email protected]

Slide 3

Slide 3 text

Examples for Collaborative Apps ؝ٓنٖ٦ءّٝ،فٔך⢽ [email protected]

Slide 4

Slide 4 text

[email protected] Realm Mobile Database

Slide 5

Slide 5 text

➡#
 Who has heard about Realm before? [email protected] Realm׾濼׏גְתַׅ

Slide 6

Slide 6 text

➡#
 Who has played around with Realm? [email protected] Realm׾⢪׏׋ֿהכ ֮׶תַׅ

Slide 7

Slide 7 text

➡#
 Who has shipped an app with Realm? [email protected] Realm׾⢪׏׋،فٔ׾ ٔٔ٦أ׃׋ֿהכ֮׶תַׅ

Slide 8

Slide 8 text

What is it?
 What is it not? Realmהכ⡦ד׃׳ֲַ ⡦דכזְד׃׳ֲַ [email protected]

Slide 9

Slide 9 text

Realm is not an ORM. RealmכORMדכ֮׶תׇ׿ 
 Realm is the database itself. ر٦ةك٦أ׉ך׮ךדׅ [email protected]

Slide 10

Slide 10 text

[email protected] Embedded 穈׫鴥׫ך NoSQL NoSQL Object-oriented ؔـآؙؑز䭷ぢ Database ر٦ةك٦أ

Slide 11

Slide 11 text

Embedded 穈׫鴥׫ = Built from scratch for mobile ٌغ؎ٕ堣㐻ך׋׭חئַٗ׵Ꟛ涪 [email protected]

Slide 12

Slide 12 text

NoSQL
 =Schema-free? أؗ٦وٖأ
 No, too inefficient. 麩ְתׅ [email protected]

Slide 13

Slide 13 text

Object-oriented ؔـآؙؑز䭷ぢ [email protected]

Slide 14

Slide 14 text

[email protected] // Person.swift import UIKit import RealmSwift class Person: Object { dynamic var name = "" dynamic var age = 0 let children = List() let parents = LinkingObjects(fromType: Person.self, property: "children") } let person = Person() person.name = "Craig" person.age = 47 let realm = try! Realm() try! realm.write { realm.add(person) } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 realmSampleApp Generic iOS Device

Slide 15

Slide 15 text

Objects all the way down. ׅץגכؔـآؙؑزדׅ [email protected]

Slide 16

Slide 16 text

Now onto
 Realm Mobile Platform [email protected]

Slide 17

Slide 17 text

[email protected] Realm Mobile Platform

Slide 18

Slide 18 text

[email protected] Deployment σϓϩΠ ؔٝفٖىأ ػـٔحؙؙٓؐس J04ת׋כ"OESPJE

Slide 19

Slide 19 text

Use Cases 崞欽✲⢽ [email protected]

Slide 20

Slide 20 text

[email protected] Device Backup ر٦ةךغحؙ،حف

Slide 21

Slide 21 text

[email protected] Cross-Device Sync رغ؎أ꟦ךず劍

Slide 22

Slide 22 text

[email protected] Real-Time Collaboration ٔ،ٕة؎يךⰟず箟꧊

Slide 23

Slide 23 text

Example ྫ Example

Slide 24

Slide 24 text

Slide 25

Slide 25 text

Slide 26

Slide 26 text

[email protected] Do you want to learn something
 great today?

Slide 27

Slide 27 text

[email protected] ➙ד׃׳

Slide 28

Slide 28 text

[email protected] You’ll learn a new vocabulary word.

Slide 29

Slide 29 text

[email protected] For that I need to introduce you to the Kanji for “clear up”.

Slide 30

Slide 30 text

[email protected] I’ll instruct you to draw this out of some radicals you already know …

Slide 31

Slide 31 text

[email protected] Start with the radical for day / sun on the middle left.

Slide 32

Slide 32 text

Slide 33

Slide 33 text

[email protected] Doing great!

Slide 34

Slide 34 text

[email protected] Next up …

Slide 35

Slide 35 text

[email protected] Good! I’ll take of the rest for now while you keep doing!

Slide 36

Slide 36 text

Slide 37

Slide 37 text

Slide 38

Slide 38 text

Slide 39

Slide 39 text

Slide 40

Slide 40 text

Slide 41

Slide 41 text

Slide 42

Slide 42 text

Slide 43

Slide 43 text

Slide 44

Slide 44 text

Slide 45

Slide 45 text

Slide 46

Slide 46 text

Slide 47

Slide 47 text

Slide 48

Slide 48 text

Slide 49

Slide 49 text

Slide 50

Slide 50 text

[email protected] So that means literally great!

Slide 51

Slide 51 text

[email protected] Replace Your Backend 傀㶷ךغحؙؒٝسءأذي׾縧ֹ䳔ִ׷

Slide 52

Slide 52 text

[email protected] ⛔ Ban JSON
 from your app. ،فٔ ַ׵JSON׾ 䱖ꤐׅ׷

Slide 53

Slide 53 text

[email protected] Swift class Account { dynamic var amount: Money dynamic var currency: Currency } JSON { “amount”: 1000.45, “currency”: “USD” } POST %7B%E2%80%9Camount%E2 %80%9D%3A+1000.45%2C+ %E2%80%9Ccurrency%E2%80 %9D%3A+%E2%80%9CUSD… Dictionary [ “amount”: Double, “currency”: String ] And decode that back on the server…

Slide 54

Slide 54 text

How? Via Built-in Notifications וֲװ׏ג
 Realmͷ鸐濼堣腉׾⢪ְתׅ [email protected]

Slide 55

Slide 55 text

Built-in Notifications
 Realmͷ௨஌ػೳ [email protected] On Individual Properties (KVO) ぐفٗػذ؍ך㢌刿׾湊鋔(KVO) On Objects ぐؔـآؙؑزך㢌刿׾湊鋔 On Collections ؝ؙٖءّٝך㢌刿׾湊鋔 On Whole File ؿ؋؎ٕⰋ⡤ך㢌刿׾湊鋔 On All Realms ׅץגךRealmؿ؋؎ٕך㢌刿׾湊鋔

Slide 56

Slide 56 text

Coupon DC9WP Coupon DC9WP coupon.code = DC9WP coupon.isValid = true 1 2 3 validate() Event Handling [email protected] ؙ٦هٝ ؙ٦هٝ 嗚鏾

Slide 57

Slide 57 text

But how do we manage access? ،ؙإأ埄ך盖椚 חאְג [email protected]

Slide 58

Slide 58 text

With a REST API? REST API׾⢪ְתַׅ [email protected]

Slide 59

Slide 59 text

No, we use Realms for that as well!
 ְְִծRealm׾⢪ְתׅ [email protected]

Slide 60

Slide 60 text

Special Realms 暴ⴽזRealm [email protected] /__admin.realm Single source of truth of all permissions ׅץגך埄ꣲ׾♧⯋盖 椚ׅ׷ /~/__management.realm Modify permissions 埄ꣲ׾㢌刿ׅ׷ /~/__permission.realm Mirrors permissions affecting this user 埄ꣲך朐䡾׾♧鋮٥然 钠ׅ׷

Slide 61

Slide 61 text

Putting it all together ֿ׸תדךתה׭ [email protected]

Slide 62

Slide 62 text

[email protected] + + /__admin.realm /userA/__management.realm User ID Permission PermissionChange /userB/__permission.realm Permission + …

Slide 63

Slide 63 text

for question in questions { say(question) { try! say(Answer(to: $0))) } } [email protected]

Slide 64

Slide 64 text

Want to learn more? ׮׏ה帾ֻ濼׶׋ְדַׅ Come to our workshop! ׈מٙ٦ؙءّحفח勻גֻ׌ְׁ try! Realm [email protected] Marius Rackwitz Katsumi Kishikawa

Slide 65

Slide 65 text

3/19th Tokyo - ౦ژɾ3݄19೔ 3/26th Osaka - େࡕɾ3݄26೔ realm.io/world-tour

Slide 66

Slide 66 text

׀幠耮֮׶ָהֲ׀ְׂת׃׋ [email protected]