Bot releases are visible (Hide)
Published by 3lvis almost 8 years ago
You might need to replace any:
import NSManagedObject_HYPPropertyMapper
With:
import SYNCPropertyMapper
And:
// Before
hyp_remote
// After
hyp_snakeCase
// Before
hyp_local
// After
hyp_camelCase
Published by 3lvis about 8 years ago
You might need to replace any broken imports with
import NSManagedObject_HYPPropertyMapper
Published by 3lvis about 8 years ago
You might need to replace any broken imports with
import NSManagedObject_HYPPropertyMapper
Published by 3lvis about 8 years ago
Published by 3lvis about 8 years ago
Published by 3lvis about 8 years ago
Published by 3lvis about 8 years ago
Published by 3lvis about 8 years ago
Published by 3lvis about 8 years ago
Published by 3lvis about 8 years ago
Published by 3lvis about 8 years ago
Published by 3lvis about 8 years ago
Update NSManagedObject-HYPPropertyMapper
dependency to fix an issue with mapping to binary data attributes.
Published by 3lvis about 8 years ago
Update NSManagedObject-HYPPropertyMapper
dependency to fix an issue with mapping to binary data attributes
Published by 3lvis about 8 years ago
This changes are also available for Swift 2.3 in Sync 1.14.0.
Now you can map more than a simple value to a dictionary key! Now you can also reference values in dictionaries that have dictionaries inside them. Basically:
{
"user": {
"first_name": "Sam"
}
}
Now if you set your hyper.remoteKey
to user.first_name
, to your firstName
attribute, then BOOM. Sync
will know how to map it. And this works for all depth levels (I only tried 2, but I'm sure it can do INFINITE).
Sometimes values in a REST API are not formatted in the way you want them, resulting in you having to extend your model classes with methods and/or properties for transformed values.
For example, what if I want to encode this title before setting it to my model?
{
"title": "Foo & bar"
}
This requires your client to handle HTML entitles each time you need title
, or using transformable attributes which would make your title
a NSData.
Welp, not anymore!
First, open your Core Data model and the name of your transformer to hyper.valueTransformer
. For this example we'll use HYPTitleEncodingValueTransformer
.
#import "HYPTitleEncodingValueTransformer.h"
@implementation HYPTitleEncodingValueTransformer
+ (Class)transformedValueClass {
return [NSString class];
}
+ (BOOL)allowsReverseTransformation {
return YES;
}
- (id)transformedValue:(id)value {
if (value == nil) return nil;
NSString *stringValue = nil;
if ([value isKindOfClass:[NSString class]]) {
stringValue = (NSString *)value;
} else {
[NSException raise:NSInternalInconsistencyException
format:@"Value (%@) is not of type NSString.", [value class]];
}
return [stringValue stringByReplacingOccurrencesOfString:@"&" withString:@"&"];
}
- (id)reverseTransformedValue:(id)value {
if (value == nil) return nil;
NSString *stringValue = nil;
if ([value isKindOfClass:[NSString class]]) {
stringValue = (NSString *)value;
} else {
[NSException raise:NSInternalInconsistencyException
format:@"Value (%@) is not of type NSString.", [value class]];
}
return [stringValue stringByReplacingOccurrencesOfString:@"&" withString:@"&"];
}
@end
Then before hyp_fillWithDictionary
we'll do
[NSValueTransformer setValueTransformer:[[HYPTitleEncodingValueTransformer alloc] init] forName:@"HYPTitleEncodingValueTransformer"];
That's it! Then your title will be "Foo & bar"
.
It works the other way as well! So using hyp_dictionary
will return "Foo & bar"
Right now using hyp_dictionary
will make a JSON of all your attributes, if you want to skip any attribute, just set hyper.nonExportable
to true
and all your problems will be solved! I mean, not all of them, but maybe some...
[NSLock unlock]: lock ( '(null)') unlocked when not locked
We've converted all the areas protected by NSLock to ones executed on a private serial dispatch queue. Hopefully this nasty warning will go away.
Fixed an issue with using hyp_dictionary
. In reserved attributes such as description
and the entity OrderedUser
. It was exporting ordered_user_description
instead of just description
.
I've been really busy at work and haven't had the time to look closely to bug reports. I'm sorry if this is blocking you or affecting you in any way, sadly it's gonna be like this at least until beginning of next month. I'm going to make sure to help as much as I can if you want to resolve any of the bugs.
I'm also really happy and super grateful for all the contributions to make this release possible. Damn, you all are awesome. Keep it up!
Published by 3lvis about 8 years ago
Published by 3lvis about 8 years ago
Swift 3 release. If you're on Swift 2.3 use this in your Podfile:
pod 'Sync', '~> 1'
Published by 3lvis about 8 years ago
The feature that would make you remove all your expectationWithDescription
and waitForExpectationsWithTimeout
.
Sync should run synchronously in automatic test environments.
Published by 3lvis about 8 years ago
test_!_key
in JSON, before it was crashing.Published by 3lvis about 8 years ago
First tag 10 gets inserted and assigned to user.
[
{
"id": 1,
"tags": [
{
"id": 10
}
]
}
]
Then tag 10 gets removed and tag 20 gets assigned to user instead. Tag 10 gets removed.
[
{
"id": 1,
"tags": [
{
"id": 20
}
]
}
]
First tag 10 gets inserted and assigned to user.
[
{
"id": 1,
"tags": [
{
"id": 10
}
]
}
]
Then tag 10 gets detached from user. Tag 10 gets removed.
[
{
"id": 1,
"tags": []
}
]
First tag 10 gets inserted and assigned to user.
[
{
"id": 1,
"tags": [
{
"id": 10
}
]
}
]
Then tag 10 gets detached from user. Tag 10 gets removed.
[
{
"id": 1,
"tags": null
}
]
Published by 3lvis about 8 years ago
Adds support for syncing entities that have super entities (just one level for now), for example, adding passengers to with a list of Racecars. All thanks to the fantastic @Jonge! Thanks ❤️.
[
{
"id": 31,
"max_speed": 370,
"passengers": [
{
"id": 22,
"name": "Jenson Button"
},
{
"id": 7,
"name": "Kimi Raikkonen"
}
]
}
]