EasyPredicate

public enum EasyPredicate : RawRepresentable

MARK: - EasyPredicate

Although NSPredicate is powerfull but the developer interface is not good enough, We can try to convert the hard code style into the object-oriented style as below.

  • Equatable prtocol

    Declaration

    Swift

    public static func == (l: EasyPredicate, r: EasyPredicate) -> Bool

    Parameters

    l

    left EasyPredicate

    r

    right EasyPredicate

    Return Value

    is equal result

  • convert to NSPredicate

    Declaration

    Swift

    public var toPredicate: NSPredicate { get }
  • Declaration

    Swift

    public var regularString: String { get }
  • merge two predicate semantics, taking their intersection

    Declaration

    Swift

    public func and(_ p: EasyPredicate) -> EasyPredicate

    Parameters

    p

    another easy predicate

    Return Value

    new predicate

  • merge two predicate semantics, taking their union

    Declaration

    Swift

    public func or(_ p: EasyPredicate) -> EasyPredicate

    Parameters

    p

    another easy predicate

    Return Value

    new predicate

  • not

    reverse the semantics of predicates

    Declaration

    Swift

    public var not: EasyPredicate { get }