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
190
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
Build your own WebP codec in Swift
kishikawakatsumi
2
950
iOSDC 2024 SMBファイル共有をSwiftで実装する
kishikawakatsumi
1
260
Enhancing Applications with Accessibility API
kishikawakatsumi
3
4.6k
Mastering SwiftSyntax
kishikawakatsumi
4
6.9k
My SwiftData Review
kishikawakatsumi
7
1.5k
Swift Expression Macros: a practical introduction
kishikawakatsumi
3
2k
Xcode Cloudの評価
kishikawakatsumi
2
1.4k
Regular expressions basics/正規表現の基本
kishikawakatsumi
7
810
家のいろいろな数値を計測する
kishikawakatsumi
4
2.4k
Other Decks in Programming
See All in Programming
コードとあなたと私の距離 / The Distance Between Code, You, and I
hiro_y
0
130
「ちょっと古いから」って避けてた技術書、今だからこそ読もう
mottyzzz
10
6.6k
Domain-centric? Why Hexagonal, Onion, and Clean Architecture Are Answers to the Wrong Question
olivergierke
2
820
Devoxx BE - Local Development in the AI Era
kdubois
0
130
CSC305 Lecture 04
javiergs
PRO
0
270
止められない医療アプリ、そっと Swift 6 へ
medley
1
160
スマホから Youtube Shortsを見られないようにする
lemolatoon
27
31k
Server Side Kotlin Meetup vol.16: 内部動作を理解して ハイパフォーマンスなサーバサイド Kotlin アプリケーションを書こう
ternbusty
3
180
CSC509 Lecture 04
javiergs
PRO
0
300
Go言語はstack overflowの夢を見るか?
logica0419
0
150
iOSエンジニア向けの英語学習アプリを作る!
yukawashouhei
0
190
dynamic!
moro
10
7.4k
Featured
See All Featured
Done Done
chrislema
185
16k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
132
19k
Unsuck your backbone
ammeep
671
58k
Visualization
eitanlees
149
16k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
15
1.7k
Learning to Love Humans: Emotional Interface Design
aarron
274
41k
Balancing Empowerment & Direction
lara
4
690
Building an army of robots
kneath
306
46k
Designing Experiences People Love
moore
142
24k
4 Signs Your Business is Dying
shpigford
185
22k
GitHub's CSS Performance
jonrohan
1032
470k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
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