SkygearIO / skygear-SDK-iOS

Skygear SDK for iOS
https://skygear.io
Other
10 stars 28 forks source link

Avoid SKYReference in relational queries #135

Open chpapa opened 7 years ago

chpapa commented 7 years ago

Chat with some team member, people keep asking why we need to do this:

SKYRecord *currentUser = [SKYContainer defaultContainer].auth.currentUser;
SKYReference *nameRef = [SKYReference referenceWithRecord:currentUser];

NSPredicate *accountPredicate = [NSPredicate predicateWithFormat:@"account = %@", nameRef];

instead of simply this:

SKYRecord *currentUser = [SKYContainer defaultContainer].auth.currentUser;
NSPredicate *accountPredicate = [NSPredicate predicateWithFormat:@"account = %@", currentUser];

I'm not sure if NSPredicate allow user to directly put an object there or not. So it maybe more like a swift only things, I don't know :(

If we can detect and support all of these, would be great:

That will greatly enhance skygear iOS SDK usability.