MotionInMotion Episode 5 - CoreData with CDQ and ruby-xcdm
CoreData with CDQ and ruby-xcdm - MotionInMotion
ActiveRecordのようにCoreDataを扱う
- Author @seriousken
- co-founder of infiniteRed
- cdq (CoreData Query)
- Steps
- setup
- Gemfile
gem 'cdq'
cdq init
- Gemfile
- schema and models
- use
- like active record
- setup
- cdq syntax
- Author.where(:name).eq("Emily")
- where / limit / offset / first
- eq / not_equal / gt / le / contains
- and / or
- AppDelegate
- include CDQ
- cdq.setup
- schema/0001_initial.rb
- schema "0001 initial" do
- entity "Article" do
- string :body, optional: false
- string / integer32 / boolean / datetime / float
- belongs_to / has_many
- entity "Article" do
- $ rake schema:build
- Writing xcdatamodel
- schema "0001 initial" do
- context
- cdq.contexts.new(NSPrivateQueueConcurrencyType)
- cdq.contexts.new(NSMainQueueConcurrencyType)
- $ cdq create model post
- ruby-xcdm
- tool for generating the same xcdatamodeld files
- fault state Core Data Programming Guide: Faulting and Uniquing
data: <fault>
Greenfield Quick Start · infinitered/cdq Wiki · GitHub- Core Data is very smart about how much data to load, and won't go fetch the details of an object until they're used.
- delegateの実装の仕方が気になった
- Blapp/app/delegates/PostsControllerAlertViewDelegate.rb
module PostsControllerAlertViewDelegate
def alertView(alertView, didDismissWithButtonIndex:buttonIndex)
include PostsControllerAlertViewDelegate
(PostsController < UITableViewController)
- Blapp/app/delegates/PostsControllerAlertViewDelegate.rb
pseudonym - 偽名、仮名、ペンネーム、ハンドルネーム