objective c - NS_DESIGNATED_INITIALIZER expected : (colon) -
i trying declare designated initializer this:
- (instancetype)initwithdelegate:(id <mydelegate>)delegate ns_designated_initializer;
but showing me compilation error:
expected ':'
interestingly when try write (reference link: adopting modern objective-c) -
- (instancetype)init ns_designated_initializer;
it shows error:
expected ';' after method prototype.
any ideas on how use ns_designated_initializer?
ns_designated_initializer
macro not defined in library headers xcode 5 - need xcode 6 use it. note link says "pre-release".
the macro defined in following way (quoting nsobjcruntime.h
)
#ifndef ns_designated_initializer #if __has_attribute(objc_designated_initializer) #define ns_designated_initializer __attribute__((objc_designated_initializer)) #else #define ns_designated_initializer #endif #endif
note can still use
- (instancetype)initwithdelegate:(id <mydelegate>)delegate __attribute__((objc_designated_initializer));
in xcode 5 or can add macro explicitly precompiled header.
Comments
Post a Comment