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 #16
Search
Kishikawa Katsumi
July 24, 2016
Programming
0
170
Realm Japan meetup #16
- Realm Objective-C/Swift 1.0.1
- Realm video tutorial
- What's new in CoreData
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
StarlingMonkeyを触ってみた話 - 2024冬
syumai
3
310
php-conference-japan-2024
tasuku43
0
380
return文におけるstd::moveについて
onihusube
1
1.3k
Go の GC の不得意な部分を克服したい
taiyow
3
890
各クラウドサービスにおける.NETの対応と見解
ymd65536
0
210
数十万行のプロジェクトを Scala 2から3に完全移行した
xuwei_k
0
400
情報漏洩させないための設計
kubotak
4
1.1k
fs2-io を試してたらバグを見つけて直した話
chencmd
0
260
React 19でお手軽にCSS-in-JSを自作する
yukukotani
5
450
CQRS+ES の力を使って効果を感じる / Feel the effects of using the power of CQRS+ES
seike460
PRO
0
180
ChatGPT とつくる PHP で OS 実装
memory1994
PRO
3
140
オニオンアーキテクチャを使って、 Unityと.NETでコードを共有する
soi013
0
290
Featured
See All Featured
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.6k
Designing Experiences People Love
moore
139
23k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
Become a Pro
speakerdeck
PRO
26
5.1k
Code Review Best Practice
trishagee
65
17k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
33
2.7k
Music & Morning Musume
bryan
46
6.2k
Speed Design
sergeychernyshev
25
690
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Visualization
eitanlees
146
15k
Transcript
Realm meetup #16
[email protected]
Katsumi Kishikawa Realm Inc.
[email protected]
Recent Updates
[email protected]
Recent Updates • Realm Objective-C/Swift 1.0.1 (was 1.0.0) • Realm
Java 1.0.1 (was 1.0.0) • Realm React Native 0.13.0 • Realm Xamarin 0.76.0
[email protected]
[email protected]
Realm Objective-C/Swift 1.0.1 (was 1.0.1)
[email protected]
Realm Objective-C/Swift 1.0.1 • RealmϑΝΠϧΛ։͘ࡍͷύϑΥʔϚϯε্ • ॻ͖ࠐΈτϥϯβΫγϣϯͷύϑΥʔϚϯε্ • RealmOptionalܕͷϓϥΠϚϦΩʔΛ࣋ͭΦϒδΣΫ τΛߋ৽Ͱ͖ͳ͍ͷमਖ਼
• objectForPrimaryKey(_:key:)ͷύϥϝʔλ͕Φϓγϣ φϧʹ • ෆ۩߹ͷमਖ਼
[email protected]
[email protected]
Already compatible with Swift 3 & Xcode 8 https://github.com/realm/realm-cocoa/issues/3796
[email protected]
Realm Objective-C/Swift 1.0.2 will be very soon!
[email protected]
Realm Video Tutorial
[email protected]
Beginning Realm on iOS www.raywenderlich.com/video-tutorials#begrealm
[email protected]
Beginning Realm on iOS raywenderlich.com
[email protected]
Beginning Realm on iOS raywenderlich.com
[email protected]
WWDC 2016
[email protected]
What’s new in Core Data
[email protected]
What’s new in Core Data • Simple Core Data Stack
• NSPersistentStoreDescription (Like RealmConfiguratin?) • Type safety • Subclass generation • Version Pinning
[email protected]
[email protected]
Simpler Core Data Stack
[email protected]
lazy var managedObjectModel: NSManagedObjectModel =
{ let modelURL = NSBundle.mainBundle().URLForResource("Example", withExtension: "momd")! return NSManagedObjectModel(contentsOfURL: modelURL)! }() lazy var persistentStoreCoordinator: NSPersistentStoreCoordinator? = { var coordinator: NSPersistentStoreCoordinator? = NSPersistentStoreCoordinator(managedObjectModel: self.managedObjectModel) let url = self.applicationDocumentsDirectory.URLByAppendingPathComponent("Example.sqlite") var error: NSError? = nil var failureReason = "There was an error creating or loading the application's saved data." if coordinator!.addPersistentStoreWithType(NSSQLiteStoreType, configuration: nil, URL: url, options: nil, error: &error) == nil { coordinator = nil NSLog("Unresolved error \(error), \(error!.userInfo)") abort() } return coordinator }() lazy var managedObjectContext: NSManagedObjectContext? = { let coordinator = self.persistentStoreCoordinator if coordinator == nil { return nil } var managedObjectContext = NSManagedObjectContext() managedObjectContext.persistentStoreCoordinator = coordinator return managedObjectContext }()
Simpler Core Data Stack
[email protected]
lazy var persistentContainer: NSPersistentContainer =
{ let container = NSPersistentContainer(name: "Example") container .loadPersistentStores(completionHandler: { (storeDescription, error) in if let error = error { fatalError("Unresolved error \(error), \(error.userInfo)") } }) return container }()
Typed fetch request
[email protected]
let request: NSFetchRequest<Dog> = Dog.fetchRequest() request.predicate
= Predicate(format: "...") request.fetchBatchSize = 20 let dogs = try! persistentContainer.viewContext.fetch(request) print(dogs)
Typed fetch request
[email protected]
let request: NSFetchRequest<Dog> = Dog.fetchRequest() request.predicate
= Predicate(format: "...") request.fetchBatchSize = 20 let dogs = try! persistentContainer.viewContext.fetch(request) print(dogs)
Insert
[email protected]
let dog = Dog(context: persistentContainer.viewContext) ... try! persistentContainer.viewContext.save()
Backgroud task
[email protected]
let context = persistentContainer.newBackgroundContext() ...
Backgroud task
[email protected]
persistentContainer.performBackgroundTask { (context) in ... }
Auto generation subclasses
[email protected]
import Foundation import CoreData class Dog:
NSManagedObject { } extension Dog { @nonobjc class func fetchRequest() -> NSFetchRequest<Dog> { return NSFetchRequest<Dog>(entityName: "Dog"); } @NSManaged var age: Int64 @NSManaged var name: String? }
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/
[email protected]
[email protected]
Realm Japan User Group Facebook
[email protected]
Support Chat Slack
[email protected]
Ξϯέʔτ http://bit.ly/RealmJP_16
[email protected]
Questions? Katsuma Kishikawa
[email protected]
www.realm.io/jp @k_katsumi