Closed CodeLife2012 closed 6 years ago
-init
and +new
should be instancetype
, not id
, which means that dot syntax should compile.
@jspahrsummers
[SomeClass new]
can work, but in a class method[self new]
or [[self alloc] init]
is not work.
Maybe it's a bug in Xcode.
In that case, just use the class' name within the class method too:
@implementation SomeClass
+ (void)foo {
… @keypath([SomeClass new], property) …
}
I am usually using it this way:
+ (NSDictionary *)JSONKeyPathsByPropertyKey {
ResultObject *this = nil;
return @{
@keypath(this.url) : @"object.url",
@keypath(this.summaryUrl) : @"object.extensions.summaryUrl",
@keypath(this.title) : @"object.title",
@keypath(this.favIconUrl) : @"faviconUrl",
@keypath(this.backgroundImageUrl) : @"backgroundImageUrl",
@keypath(this.fallbackImageUrl) : @"fallbackImageUrl",
@keypath(this.backgroundImageSourceUrl) : @"backgroundImageSourceUrl",
};
}
@k06a looks great
Sometimes may want to autofill a object in
@keypath(object, property)
, but we can't use[self new]
or[[self alloc] init]
because xCode treat these object aid
type.Actually it's not a bug in this library, but anyone has a workaround for this?