Open RomainPln opened 6 years ago
Have you found a solution or workaround for this?
My workaround:
extension NSManagedObject {
// This has the function of MagicalRecord MR_executeFetchRequest, but is compatible with Swift
static func fetch(_ request: NSFetchRequest<NSFetchRequestResult>) -> [Any]? {
let context = NSManagedObjectContext.mr_default()
var categoryObjects: [Any]?
context.performAndWait() {
do {
categoryObjects = try context.fetch(request)
} catch {
categoryObjects = nil
}
}
return categoryObjects
}
}
Hi, I want to find all distinct values of aPropertyName on MyEntity records, I wrote:
As a result I have
Whatever I try to do with testResult. Trying to cast testResult does not work and produces the same runtime crash. (A workaround could be to map a classic request result but that's less efficient and elegant)