-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathQSObjectValueTransformerET.m
47 lines (40 loc) · 1.1 KB
/
QSObjectValueTransformerET.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//
// QSObjectValueTransformerET.m
// QSEventTriggersElement
//
// Created by Rob McBroom on 2014/01/23.
//
//
#import "QSObjectValueTransformerET.h"
@implementation QSObjectValueTransformerET
- (Class)transformedValueClass
{
return [NSMutableArray class];
}
+ (BOOL)allowsReverseTransformation
{
return YES;
}
- (NSMutableArray *)transformedValue:(NSMutableArray *)objectIDs
{
// turn an array of identifiers into an array of QSObjects
if ([objectIDs count]) {
NSMutableArray *objects = [[NSMutableArray alloc] init];
QSObject *restriction = nil;
for (NSString *ident in objectIDs) {
restriction = [QSLib objectWithIdentifier:ident];
if (!restriction) {
restriction = [QSObject objectWithString:ident];
}
[objects addObject:restriction];
}
return objects;
}
return nil;
}
- (NSMutableArray *)reverseTransformedValue:(NSMutableArray *)objects
{
// turn an array of QSObjects into an array of identifiers
return [objects arrayByPerformingSelector:@selector(identifier)];
}
@end