Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for CBL-ios issue 648 #669

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 26 additions & 4 deletions Source/API/CBLModel+Properties.m
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ + (IMP) impForGetterOfProperty: (NSString*)property ofClass: (Class)propertyClas
return [receiver getArrayRelationProperty: property withModelClass: itemClass];
};
}
} else {
}
else {
// Typed array of scalar class:
ValueConverter itemConverter = valueConverterToClass(itemClass);
if (itemConverter) {
Expand All @@ -247,20 +248,30 @@ + (IMP) impForGetterOfProperty: (NSString*)property ofClass: (Class)propertyClas
return [receiver getProperty: property withConverter: converter];
};
}
else if([itemClass isSubclassOfClass: [NSObject class]])
{
return [super impForGetterOfProperty: property ofClass: itemClass];
}
}
} else if ([propertyClass isSubclassOfClass: [CBLModel class]]) {
// Model-valued property:
impBlock = ^id(CBLModel* receiver) {
return [receiver getModelProperty: property];
};
} else {
}

else {
// Other property type -- use a ValueConverter if we have one:
ValueConverter converter = valueConverterToClass(propertyClass);
if (converter) {
impBlock = ^id(CBLModel* receiver) {
return [receiver getProperty: property withConverter: converter];
};
}
else if([propertyClass isSubclassOfClass: [NSObject class]])
{
return [super impForGetterOfProperty: property ofClass: propertyClass];
}
}

return impBlock ? imp_implementationWithBlock(impBlock) : NULL;
Expand Down Expand Up @@ -300,7 +311,13 @@ + (IMP) impForSetterOfProperty: (NSString*)property ofClass: (Class)propertyClas
}
[receiver setValue: value ofProperty: property];
};
} else {
}
else if ([propertyClass isSubclassOfClass: [NSObject class]])
{
return [super impForSetterOfProperty: property ofClass: propertyClass];
}

else {
// Scalar-valued array:
impBlock = ^(CBLModel* receiver, NSArray* value) {
[receiver setValue: value ofProperty: property];
Expand All @@ -316,7 +333,12 @@ + (IMP) impForSetterOfProperty: (NSString*)property ofClass: (Class)propertyClas
}
[receiver setValue: value ofProperty: property];
};
} else {
}
else if ([propertyClass isSubclassOfClass: [NSObject class]])
{
return [super impForSetterOfProperty: property ofClass: propertyClass];
}
else {
return [super impForSetterOfProperty: property ofClass: propertyClass];
}

Expand Down