Download free for 30 days
Sign in
Upload
Language (EN)
Support
Business
Mobile
Social Media
Marketing
Technology
Art & Photos
Career
Design
Education
Presentations & Public Speaking
Government & Nonprofit
Healthcare
Internet
Law
Leadership & Management
Automotive
Engineering
Software
Recruiting & HR
Retail
Sales
Services
Science
Small Business & Entrepreneurship
Food
Environment
Economy & Finance
Data & Analytics
Investor Relations
Sports
Spiritual
News & Politics
Travel
Self Improvement
Real Estate
Entertainment & Humor
Health & Medicine
Devices & Hardware
Lifestyle
Change Language
Language
English
Español
Português
Français
Deutsche
Cancel
Save
Submit search
EN
Uploaded by
Shingo Sato
4,839 views
俺のManaged Objectの使い方は間違っていた
Core Dataの
Technology
◦
Read more
15
Save
Share
Embed
Embed presentation
Download
Downloaded 12 times
1
/ 17
2
/ 17
3
/ 17
4
/ 17
5
/ 17
6
/ 17
7
/ 17
8
/ 17
9
/ 17
10
/ 17
11
/ 17
12
/ 17
13
/ 17
14
/ 17
15
/ 17
16
/ 17
17
/ 17
More Related Content
PDF
Objective-C のキャストと Swift の型変換を比べてみる #akibaswift
by
Tomohiro Kumagai
PDF
「もののけ大戦“陣”」製作事例
by
Ryohei Tokimura
PDF
ダイスふる制作レポート Unityでアプリ個人開発
by
Ryohei Tokimura
PPTX
[0410 박민근] 기술 면접시 자주 나오는 문제들
by
MinGeun Park
PDF
CoreDataでのsubqueryの使い方
by
Masaru Ichikawa
PPTX
라이트,라이트맵,라이트프로브,누가가장가볍고이쁠까
by
GukHwan Ji
PDF
Functional Programming (で遊ぶ)
by
Rakuten Group, Inc.
PDF
Java8 lambdas chapter1_2
by
yo0824
Objective-C のキャストと Swift の型変換を比べてみる #akibaswift
by
Tomohiro Kumagai
「もののけ大戦“陣”」製作事例
by
Ryohei Tokimura
ダイスふる制作レポート Unityでアプリ個人開発
by
Ryohei Tokimura
[0410 박민근] 기술 면접시 자주 나오는 문제들
by
MinGeun Park
CoreDataでのsubqueryの使い方
by
Masaru Ichikawa
라이트,라이트맵,라이트프로브,누가가장가볍고이쁠까
by
GukHwan Ji
Functional Programming (で遊ぶ)
by
Rakuten Group, Inc.
Java8 lambdas chapter1_2
by
yo0824
Featured
PDF
2024 Trend Updates: What Really Works In SEO & Content Marketing
by
Search Engine Journal
PDF
Storytelling For The Web: Integrate Storytelling in your Design Process
by
Chiara Aliotta
PDF
ChatGPT and the Future of Work - Clark Boyd
by
Clark Boyd
PDF
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
by
OECD Directorate for Financial and Enterprise Affairs
PDF
Everything You Need To Know About ChatGPT
by
Expeed Software
PDF
5 Public speaking tips from TED - Visualized summary
by
SpeakerHub
PDF
How Race, Age and Gender Shape Attitudes Towards Mental Health
by
ThinkNow
PDF
Social Media Marketing Trends 2024 // The Global Indie Insights
by
Kurio // The Social Media Age(ncy)
PDF
Google's Just Not That Into You: Understanding Core Updates & Search Intent
by
Lily Ray
PPTX
How to Prepare For a Successful Job Search for 2024
by
Albert Qian
PDF
Product Design Trends in 2024 | Teenage Engineerings
by
Pixeldarts
PDF
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
by
SocialHRCamp
PDF
2024 State of Marketing Report – by Hubspot
by
Marius Sescu
PDF
PEPSICO Presentation to CAGNY Conference Feb 2024
by
Neil Kimberley
PDF
Skeleton Culture Code
by
Skeleton Technologies
PDF
Getting into the tech field. what next
by
Tessa Mero
PDF
Trends In Paid Search: Navigating The Digital Landscape In 2024
by
Search Engine Journal
PDF
Content Methodology: A Best Practices Report (Webinar)
by
contently
PDF
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
by
marketingartwork
PDF
How to have difficult conversations
by
Rajiv Jayarajah, MAppComm, ACC
2024 Trend Updates: What Really Works In SEO & Content Marketing
by
Search Engine Journal
Storytelling For The Web: Integrate Storytelling in your Design Process
by
Chiara Aliotta
ChatGPT and the Future of Work - Clark Boyd
by
Clark Boyd
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
by
OECD Directorate for Financial and Enterprise Affairs
Everything You Need To Know About ChatGPT
by
Expeed Software
5 Public speaking tips from TED - Visualized summary
by
SpeakerHub
How Race, Age and Gender Shape Attitudes Towards Mental Health
by
ThinkNow
Social Media Marketing Trends 2024 // The Global Indie Insights
by
Kurio // The Social Media Age(ncy)
Google's Just Not That Into You: Understanding Core Updates & Search Intent
by
Lily Ray
How to Prepare For a Successful Job Search for 2024
by
Albert Qian
Product Design Trends in 2024 | Teenage Engineerings
by
Pixeldarts
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
by
SocialHRCamp
2024 State of Marketing Report – by Hubspot
by
Marius Sescu
PEPSICO Presentation to CAGNY Conference Feb 2024
by
Neil Kimberley
Skeleton Culture Code
by
Skeleton Technologies
Getting into the tech field. what next
by
Tessa Mero
Trends In Paid Search: Navigating The Digital Landscape In 2024
by
Search Engine Journal
Content Methodology: A Best Practices Report (Webinar)
by
contently
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
by
marketingartwork
How to have difficult conversations
by
Rajiv Jayarajah, MAppComm, ACC
俺のManaged Objectの使い方は間違っていた
1.
俺のManaged Objectの使い方 は間違っていた iOS_LT#12 on
2014.4.23 佐藤 新悟
2.
NSManagedObject • Core Dataで管理されるモデルオブジェクト •
そのまま使っても良いけど、属性に valueForKey:とかでアクセスしないといけない • 通常サブクラスでpropertyを定義して使う
3.
intとかBOOLにNSNumberを 使わなくてもいい
4.
やりがちなこと // interface @property (nonatomic,
strong) NSNumber *flag; // implementation - (BOOL)flagValue { return [self.flag boolValue]; } ! - (void)setFlagValue:(BOOL)value { self.flag = @(value); }
5.
スカラープロパティを使う
6.
スカラープロパティを使う // interface @property (nonatomic,
assign) BOOL flag; ! // implementation @dynamic flag; やることはこれだけ!
7.
スカラープロパティを使う • Appleのドキュメントにスカラー値を使う場合アクセサは 自前で実装しろと書いてあるがこれは古い記述 • XcodeにやらせるとNSDateまでNSTimeintervalになるが気に 入らなければNSDateに直せばいい •
スカラーとオブジェクトの変換コストはもちろんある。コ レクションに入れたりするならNSNumberのままもあり。
8.
属性で扱えないオブジェクトも 自前で変換処理を書かなくていい
9.
やりがちなこと // interface ! // attribute @property
(nonatomic, strong) NSString *colorString; // attributeじゃない @property (nonatomic, strong) UIColor *color; ! ! // implementation - (UIColor *)color { UIColor *color = nil; // self.colorString のカラーコードからUIColorを作る return color; } ! - (void)setColor:(UIColor *)color { NSString *colorString = nil; // UIColorからカラーコードの文字列を作る self.colorString = colorString; }
10.
Transformableを使う // interface @property (nonatomic,
strong) UIColor *color; ! // implementation @dynamic color; やることはこれだけ!
11.
Transformableを使う • NSCodingに準拠したオブジェクトはすべて同様に扱 える • 裏でNSValueTransformerが値を変換している •
カスタムのvalue transformerを定義すればNSCoding じゃないどんなオブジェクトも扱える。 ※標準の属性タイプのいずれかに変換できれば
12.
entityの継承関係とクラスの 継承関係は一致してなくていい
13.
よくある設計 Animal Cat Human Animal Cat Human Entity
Class NSManaged Object
14.
EntityとClassは独立に設計可能 Animal Cat Human Animal Cat
Human Entity Class NSManaged Object BaseManaged Object
15.
EntityとClassは独立に設計可能 • Entityを継承するとDB上ではひとつの大きな テーブルができるので、データの持ち方として 効率的ではない • すべてのManaged
Objectで共通にやりたいこと をBaseサブクラスに書いて、Entityに対応するク ラスはそれを継承する、といったことが可能
16.
まとめ • スカラー値のプロパティを使うにはプリミティ ブ型で宣言するだけでOK • NSCoding準拠のオブジェクトはTransformable を使おう •
Entityの階層とClassの階層は独立に設計できる
17.
参考URL • Core Dataでスカラー値をプリミティブ型のプロパティで扱う方法
- Qiita http://qiita.com/gonsee/items/4daff9c7c86e8cae836b • Data Models and Model Objects - Core Data - objc.io issue #4 http://www.objc.io/issue-4/core-data-models-and-model-objects.html • Core Data Programming Guide: Non-Standard Persistent Attributes https://developer.apple.com/library/ios/documentation/cocoa/conceptual/ CoreData/Articles/cdNSAttributes.html#//apple_ref/doc/uid/TP40001919-SW1
Download