1 year ago
#320992
Mike Nathas
More complex filterPredicate for NSArrayController
I am using a NSArrayController
which has a Managed Object Context to present data of a CoreData source in a NSTableView
.
Everything works fine, I can also use filterPredicate
to filter my results which also reflect in the NSTableView
.
For example
coreDataArrayController.filterPredicate = NSPredicate(format: "dataType == %@","live_data")
shows only the rows with this specific value "live_data" in the "dataType" attribute.
I do have some binary data in the CoreData database which I can parse using custom functions. Is there a way I can filter using this information too?
For example I have an attribute "binary_data" which contains binary representation of a NSImage
. I now want to check the image type of this NSImage
and use this information to filter my dataset.
Something like:
coreDataArrayController.filterPredicate = NSPredicate(format: "imageType(binary_data) == %@,"png")
To show only rows that contain an image in "binary_data" that is a png (which is checked by my custom function "imageType"
swift
xcode
cocoa
core-data
nstableview
0 Answers
Your Answer