Sha256: f4dbacb9a9b0484ee773eef80b48ddd52cf692cfd7c3d5d9a1adc8ed1ebf9f9c

Contents?: true

Size: 1008 Bytes

Versions: 2

Compression:

Stored size: 1008 Bytes

Contents

import Foundation

extension QuerySet {
    public func asQKQuerySet() -> QKQuerySet {
        let entityDescription = NSEntityDescription.entityForName(entityName, inManagedObjectContext: context)

        var nsrange:NSRange = NSMakeRange(NSNotFound, NSNotFound)
        if let range = self.range {
            nsrange = NSMakeRange(range.startIndex, range.endIndex - range.startIndex)
        }

        return QKQuerySet(managedObjectContext: context, entityDescription: entityDescription, predicate: predicate, sortDescriptors: sortDescriptors, range:nsrange)
    }
}

extension QKQuerySet {
    public func asQuerySet() -> QuerySet<NSManagedObject> {
        let queryset = QuerySet<NSManagedObject>(managedObjectContext, entityDescription.name!)
            .orderBy(sortDescriptors as [NSSortDescriptor])
            .filter(predicate)

        if range.location != NSNotFound {
            return queryset[range.location..<(range.location + range.length)]
        }

        return queryset
    }
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cocoapods-deintegrate-0.2.1 spec/fixtures/Project/Frameworks/Pods/QueryKit/QueryKit/ObjectiveC/QKQuerySet.swift
cocoapods-deintegrate-0.2.0 spec/fixtures/Project/Frameworks/Pods/QueryKit/QueryKit/ObjectiveC/QKQuerySet.swift