Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Realm Japan meetup #2 (Recent Updates for Realm)

Kishikawa Katsumi
April 26, 2015
330

Realm Japan meetup #2 (Recent Updates for Realm)

Recent Update for Realm

- Realm Java 0.80.0 to 0.80.1
- Realm Cocoa 0.91.0 to 0.91.3
- Null support beta
- RealmSwift

Kishikawa Katsumi

April 26, 2015
Tweet

Transcript

  1. Realm Java 0.80.1 • ιʔτͷύϑΥʔϚϯεͱɺจࣈྻͷΠϯαʔτͷ଎ ౓͕վળ • RealmQueryʹisNull()ͱisNotNull()ϝιου͕௥Ճ • ؔ࿈͕NULL͔ͱ͍͏৚݅ͰݕࡧͰ͖ΔΑ͏ʹ

    • ؔ࿈Ҏ֎ʹ͍ͭͯ͸ͦΕͧΕͷσʔλܕʢจࣈྻͳ ͲʣͷNULLαϙʔτ͕׬ྃޙ • Realm.deleteRealmFile(File)ϝιου͕௥Ճ͞Ε·͠ ͨ
  2. RLMCollection supports collection KVC operations if let posts = Post.objectsWithPredicate(

    NSPredicate(format: "active == FALSE")) as RLMResults? { realm.beginWriteTransaction() for postObj in posts { if let post = postObj as? Post { post.active = true } } realm.commitWriteTransaction() }
  3. RLMCollection supports collection KVC operations let posts = Post.objectsWhere("active ==

    FALSE") realm.transactionWithBlock { while posts.count > 0 { if let post = posts.firstObject() as? Post { post.active = true } } }
  4. RLMCollection supports collection KVC operations let posts = Post.objectsWhere("active ==

    FALSE") realm.transactionWithBlock { posts.setValue(false, forKey: "active") }
  5. NULL Support BETA Cocoa൛ͷRealmͰɺNULLϓϩύςΟͷαϙʔτʹ͍ͭͯϕʔλςετΛ࣮ࢪ͠·͢ɻ https://github.com/realm/realm-cocoa/issues/628#issuecomment-94050752 ·ͣɺRealm Core Null v1ͱ໊෇͚ΒΕͨ͜ͷβόʔδϣϯͰ͸·ͩNULLϓϩύςΟ͸ར༻Ͱ͖·ͤΜɻ͔͠ ͠ɺطଘͷRealmϑΝΠϧΛNULLΛαϙʔτ͢Δ৽͍͠ϑΝΠϧܗࣜʹࣗಈతʹߋ৽͠·͢ɻ

    ͜Ε͸࣍ͷv2ϑΣʔζʹਐΉͨΊͷඇৗʹॏཁͳ޻ఔͰ͢ɻ ϕʔλςελʔͷํʹΑΔ֬ೝΛܦΔ͜ͱͳ͘ɺNULLจࣈྻͷαϙʔτͷػೳΛϦϦʔε͢Δ͜ͱ͸͋Γ· ͤΜɻจࣈྻҎ֎ͷܕʹ͍ͭͯ͸ͦͷޙʹॱ࣍αϙʔτ͞ΕΔ༧ఆͰ͢ɻ ΋͠໰୊Λݟ͚ͭͨ࣌͸ͲΜͳখ͞ͳ͜ͱͰ΋ڭ͍͑ͯͩ͘͞ɻ໰୊ͷใࠂ͸Github IssuesͰड͚෇͚͍ͯ· ͢ɻ https://github.com/realm/realm-cocoa/issues ใࠂͷࡍʹ͸ɺ“null beta”Λར༻͍ͯ͠Δ͜ͱΛʮඞͣʯॻ͍͍ͯͩ͘͞ɻ NULLαϙʔτؚ͕·ΕͨRealm Core͸ҎԼͷURL͔Βμ΢ϯϩʔυ͢Δ͜ͱ͕Ͱ͖·͢ɻ https://static.realm.io/downloads/core/realm-core-null-v1.zip
  6. NULL Support BETA # ಋೖͷํ๏ʹ͍ͭͯ ## Realm.frameworkΛιʔείʔυ͔ΒϏϧυͯ͠ར༻͍ͯ͠Δ৔߹ 1. https://github.com/realm/realm-cocoa ͷmaster͔ΒιʔείʔυΛऔಘ͠·͢

    2. CoreͷϥΠϒϥϦʢcore-0.89.0σΟϨΫτϦʹ͋Γ·͢ʣΛ্هͷzipΞʔΧΠϒͷ಺༰ͱೖΕସ͑·͢ 3. Realm.frameworkΛ࠶Ϗϧυ͠·͢ ## CocoaPodsΛར༻͍ͯ͠Δ৔߹ 1. CoreͷϥΠϒϥϦʢPods/Realm/coreʣΛ্هͷzipΞʔΧΠϒͷ಺༰ͱೖΕସ͑·͢ ## realm.ioͷτοϓϖʔδ͔Βμ΢ϯϩʔυͰ͖ΔzipϑΝΠϧʢϏϧυࡁΈϑϨʔϜϫʔΫʣΛར༻͍ͯ͠ Δ৔߹ ϏϧυࡁΈϑϨʔϜϫʔΫ͸ίΞΛೖΕସ͑ͯ࠶Ϗϧυ͢Δ͜ͱ͕Ͱ͖·ͤΜͷͰɺ࣍ʹϦϦʔε͞ΕΔϏ ϧυࡁΈϑϨʔϜϫʔΫͷϕʔλϦϦʔεΛ͓଴͍ͪͩ͘͞ɻ
  7. RealmSwift let realm = RLMRealm.defaultRealm() realm.beginWriteTransaction() realm.addObject(mydog) realm.commitWriteTransaction() let allDogs

    = Dog.allObjects() for dog in allDogs { let dog = dog as! Dog let ownerNames = dog.owners.map { $0.name } println("\(dog.name)") }
  8. RealmSwift let realm = Realm() realm.write { realm.create(Person.self, value: ["John",

    [["Fido", 1]]]) realm.create(Person.self, value: ["Mary", [["Rex", 2]]]) } // Log all dogs and their owners using the "owners" inverse relationship let allDogs = realm.objects(Dog) for dog in allDogs { let ownerNames = dog.owners.map { $0.name } println("\(dog.name)") }
  9. Where to find us • Realm Japan User Group: facebook.com/groups/realmjp

    • Twitter: twitter.com/realm • GitHub: github.com/realm • StackOverflow: ja.stackoverflow.com/questions/tagged/realm • Email: [email protected] • Slack: slack.realm.io/