Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
New Library for CoreData
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Muukii
July 13, 2015
Programming
2.9k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
New Library for CoreData
Muukii
July 13, 2015
More Decks by Muukii
See All by Muukii
Problem Solving from the Abstraction Layer
muukii0803
1
82
Pairs iOSとトレンドの技術
muukii0803
0
1.1k
Thoughts about build flow
muukii0803
2
370
スマホアプリ開発で大切なこと
muukii0803
3
200
エンジニアとして働くために
muukii0803
0
220
Q. Textureは部分的に導入できますか?
muukii0803
3
2.6k
安定したチャットを実現するための アプリとAPI設計
muukii0803
17
8.7k
快適なUIを持つアプリを作るために できること
muukii0803
12
2.8k
iOS エンジニアが考える Webアプリ開発
muukii0803
3
540
Other Decks in Programming
See All in Programming
Long Living Tokens, Die, Die, Die! (or: The One Ring is Banned in Modern)
sylph01
0
300
個人開発者よ、Honoを使え(おじさんver)
tanahiro2010
2
260
パスワード再設定メールのURLについて知っておこう
uyuki234
0
160
Railsのためのパスキー実践入門 〜マルチテナントSaaSでの意思決定〜
utakaha
2
550
S3 TablesのIcebergデータに、AIエージェントからアクセスしてみた / 20261016developersio2026joetsu-accessing-iceberg-in-s3tables-via-agent
kasacchiful
PRO
0
150
[Dev Group Paris Octobre 26] Agentforce, SIforce, Claudeforce, Slackbot… on s'y retrouve ?
nabondance
0
110
當我們開始不讀 Code - AI Agent 時代,Code Review 與 Clean Code 還剩下什麼?
jame2408
1
200
Railsバージョンを4倍にした話
optim
0
350
気持ちぃ〜角丸 Squircle
ryu1013
0
310
JIS keyboard support in Omarchy
lef237
0
110
AI主導のプログラミング学習アプリを作ってみた
econanringo
0
180
Verilogで学ぶCPU自作入門
uyuki234
8
4.1k
Featured
See All Featured
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
550
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.7k
Tell your own story through comics
letsgokoyo
1
1.1k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.3k
WENDY [Excerpt]
tessaabrams
14
40k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
2
2k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.7k
Transcript
New Library for CoreData Hiroshi Kimura potatotips #19
ଜ Hiroshi Kimura iOS Developer eureka, Inc. @muukii0803
None
None
None
CoreStore https://github.com/JohnEstropia/CoreStore
Developer Hiroshi Kimura eureka, Inc. @muukii0803 John Estropia eureka, Inc.
@JohnEstropia
Good things :)
Good things :) • SwiftͰॻ͔Ε͍ͯΔ
Good things :) • SwiftͰॻ͔Ε͍ͯΔ • ϝΠϯεϨουͷContextRead-Only ॻ͖ࠐΈͯ͢SerialʹBackgroundContextͰߦΘΕΔͨΊɺ ҆શʹಈ࡞͢Δઃܭ
Good things :) • SwiftͰॻ͔Ε͍ͯΔ • ϝΠϯεϨουͷContextRead-Only ॻ͖ࠐΈͯ͢SerialʹBackgroundContextͰߦΘΕΔͨΊɺ ҆શʹಈ࡞͢Δઃܭ •
ෳͷSQLiteϑΝΠϧ͕༻Մೳ (ConfigurationͰ͚Δ)
Good things :) • SwiftͰॻ͔Ε͍ͯΔ • ϝΠϯεϨουͷContextRead-Only ॻ͖ࠐΈͯ͢SerialʹBackgroundContextͰߦΘΕΔͨΊɺ ҆શʹಈ࡞͢Δઃܭ •
ෳͷSQLiteϑΝΠϧ͕༻Մೳ (ConfigurationͰ͚Δ) • Observer͕༻ҙ͞Ε͍ͯΔ (FRCΛॻ͔ͳͯ͘ྑ͘ͳΔ)
Good things :) • SwiftͰॻ͔Ε͍ͯΔ • ϝΠϯεϨουͷContextRead-Only ॻ͖ࠐΈͯ͢SerialʹBackgroundContextͰߦΘΕΔͨΊɺ ҆શʹಈ࡞͢Δઃܭ •
ෳͷSQLiteϑΝΠϧ͕༻Մೳ (ConfigurationͰ͚Δ) • Observer͕༻ҙ͞Ε͍ͯΔ (FRCΛॻ͔ͳͯ͘ྑ͘ͳΔ) • ϚΠάϨʔγϣϯΛαϙʔτ
Usage
DataStack struct Stack { static let data: DataStack = {
let dataStack = DataStack(modelName: "CoreData") dataStack.addSQLiteStoreAndWait( "CoreData.sqlite", configuration: nil, resetStoreOnMigrationFailure: true ) return dataStack }() } SQLiteʹඥͮ͘DataStackΛੜ͠·͢
struct Stack { static let dataA: DataStack = { let
dataStack = DataStack(modelName: "StackSetupDemo") dataStack.addSQLiteStoreAndWait( "CoreData.sqlite", configuration: "Configuration_A", resetStoreOnMigrationFailure: true ) return dataStack }() static let dataB: DataStack = {...} static let dataC: DataStack = {...} } Configuration͝ͱʹDataStackͷੜ͕Մೳ ࠓճConfigurationΛΘͳ͍ํ๏ͰਐΊ͍͖ͯ·͢ɻ
let people = Stack.data.fetchAll( From(MyPersonEntity), Where("age > 30"), OrderBy(.Ascending("name"), .Descending("age")),
Tweak { (fetchRequest) -> Void in fetchRequest.includesPendingChanges = false } ) Fetch NSSortDescriptor, NSPredicateΘͣʹࢦఆ ࡉ͔͍ઃఆTweakͰࢦఆՄೳ
Stack.data.beginAsynchronous { (transaction) -> Void in let qrcode = transaction.create(Into(QRCode))
let codes = transaction.fetch( . . . ) transaction.commit() { result in switch result { case .Success(let hasChanges): success?() case .Failure(let error): failure?(error: error) } } } Create - Update
ViewController Fetch - Observe
Fetch
Controller͔ΒCoreDataΛ͏࣌ͬͯ
Controller͔ΒCoreDataΛ͏࣌ͬͯ NSFetchedResultsController ?
Controller͔ΒCoreDataΛ͏࣌ͬͯ
Controller͔ΒCoreDataΛ͏࣌ͬͯ ManagedObjectListController
var codes: ManagedObjectListController<QRCode> = { return Stack.data.observeObjectList( From(QRCode), Where("removed ==
false”), OrderBy(.Descending("readAt")) ) }() Controllerʹදࣔ͢ΔΦϒδΣΫτͷ݅Λࢦఆ
codes.numberOfSections() SectionͷΛऔಘ
codes.numberOfObjectsInSection(section) Section͔ΒObjectͷΛऔಘ
let code = codes[indexPath] NSIndexPath͔ΒObjectΛऔಘ
Observe
codes.removeObserver(self) codes.addObserver(self) Observe Observeͷ։࢝ Observeͷऴྃ
protocol ManagedObjectListChangeObserver • WillChange • Insert • Delete • Update
• Move • InsertSection • deleteSection • DidChange GenericsͰ࣮͞Ε͍ͯΔͨΊɺas ͕ෆཁ
Conclusion • DataStackΛϕʔεʹಈ࡞͢Δ • Fetchͷهड़͕γϯϓϧ • DataStack͝ͱʹγϦΞϧΩϡʔͰಈ࡞͢ΔͨΊ҆શ • ViewControllerͱͷ࿈ܞ͕؆୯ •
ϚΠάϨʔγϣϯ͕ॆ࣮ ΠϯΫϦϝϯλϧʹϚΠάϨʔγϣϯ͢Δ͜ͱՄೳ • GenericsͰ࣮͞Ε͍ͯΔͨΊμΠφϛοΫΩϟετ͕ݮΒͤΔ
Swift2.0
Thank you :)
Thank you :)