[心得] @class directive

看板MacDev作者 (白毛)時間11年前 (2013/07/23 14:53), 編輯推噓3(302)
留言5則, 3人參與, 最新討論串1/1
當Core Data的entity間有relationship時 該entity的subclass of NSManagedObject的header file會看到@class的用法 基本上 @class MyClass的效果跟#import "MyClass"類似 只不過@class 只告訴complier 「MyClass是一個class」 但沒有告訴compiler其它的資訊 ex:method, property 這裡有一篇在談@class directive 分享給大家 http://www.iosappsforeveryone.com/Chapter2Part6ReferencingClasses.htm -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.230.79.222

07/24 09:28, , 1F
這個可能要寫過c/c++的人比較好理解為什麼要這樣做 =P
07/24 09:28, 1F

07/24 09:30, , 2F
我是不知道obj-c這樣能不能減低過大的相依性讓編譯速度
07/24 09:30, 2F

07/24 09:30, , 3F
以及整個結構都變好就是...
07/24 09:30, 3F

07/25 11:12, , 4F
專有名詞應該是 forward declare
07/25 11:12, 4F

07/25 13:39, , 5F
文章裡就有提到了吧 forward declaration
07/25 13:39, 5F
文章代碼(AID): #1HxYXPyj (MacDev)