I want to perform a filtering on a Transformable
attribute on Core Data. The Transformer
value is actually an NSAttributedString
. I tried to set a predicate like below:
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(attributedString CONTAINS[cd] %@), _searchString];
It did not work. It certainly works with a String
attribute.
I've googled it for a whole day, yet no luck. Can someone tell me how to achieve that? Thanks!
I want to perform a filtering on a
Transformer
attribute on Core Data.
If you mean a Core Data "transformable" attribute, you really can't do that. Transformed attributes are simply a collection of bytes when they're stored in Core Data. It's not an attributed string in the persistent store-- it's just ones and zeroes. As a result you can't filter based on the attributed string contents.
Strings work because Core Data saves them as strings. But transformable attributes don't work that way. The only predicate you can use with this attribute is one that checks for nil or non-nil values.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With