Hi
The SwiftUI app I am currently developing has private and public databases. When the public database is published to, I want to offer the user tha ability to edit their own records, however, I can't see how I can filter this as the created by field does not seem to be available as a predicate for FetchRequest.
My thinking was then to CKContainer and fetchUserRecordId and store the returned hash for recordName in the public record, and then use the predicate to compare to the value for the current user using a dynamic predicate. But that would make everyone's hash public, and I suspect that's a security hole, even if it is just my app and public data.
My other thinking is that I could keep track of a UUID assigned to the public record by recording it in a record in the private database and then use a dynamic predicate, but this seems clumsy and makes me think I must be doing something wrong. It would be simple enough to implement though, and in the absence of anything else, that's likely the way I will go.
I have looked also at canUpdateRecord etc - but these aren't filters from what I can see, they would return true after fetching and I don't want to fetch records that I don't need to. In fact when I tried them out to exclude in a list, they didn't work as I'd expected anyway.
So, does anyone know if there a simple way to only fetch records created by the current user from the public database in a SwiftUI app, or do I need to delve into CloudKit itself (or more likely, go with my private record of the UUIDs and dynamically create a predicate)?
Thanks,
Ian