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
78
Pairs iOSとトレンドの技術
muukii0803
0
1.1k
Thoughts about build flow
muukii0803
2
360
スマホアプリ開発で大切なこと
muukii0803
3
200
エンジニアとして働くために
muukii0803
0
220
Q. Textureは部分的に導入できますか?
muukii0803
3
2.6k
安定したチャットを実現するための アプリとAPI設計
muukii0803
17
8.6k
快適なUIを持つアプリを作るために できること
muukii0803
12
2.8k
iOS エンジニアが考える Webアプリ開発
muukii0803
3
540
Other Decks in Programming
See All in Programming
標準パッケージに uuid が追加された 背景から見る Go らしい意思決定 / go_127_uuid_decision
convto
5
8.3k
動作中のプログラムの中身をリアルタイムに覗く / Realtime Debugger for CSharp with Roslyn
prota
1
1.2k
Jetpack Compose メカニズム
skydoves
0
470
AWSに止められる覚悟してますか?
morizo_1984
1
160
巨大モノリシックアプリ モダン化大作戦
ktcryomm
1
1.1k
Security issues being discussed on Web Platforms
petamoriken
0
1.2k
個人開発基盤をまるごとCloudflareに引っ越して爆速で総合的体験を向上させた話
tinykitten
0
200
Are APIs Still Relevant in the AI Era?
soyuka
0
310
フロントエンドUIフレームワークのこれまでとこれから
ssssota
5
2.9k
AWS Step Functions 大規模並列の壁を越える / jaws-sonic-2026-niigata-step-functions
kasacchiful
PRO
1
520
そのリトライ、死んだコネクションを使い回していませんか ── GoのHTTPクライアントとHTTP/2を実プロダクト障害から学び直す
myus4a
0
230
LoopHub - ローカルで動く GitHub で、AI と共同開発
jugyo
1
570
Featured
See All Featured
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
510
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
1k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
330
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2.1k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
440
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.4k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.3k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.4k
We Are The Robots
honzajavorek
0
380
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
370
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 :)