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.
-
Declaration
Swift
case exists(_: Bool)
-
Declaration
Swift
case isEnabled(_: Bool)
-
Declaration
Swift
case isHittable(_: Bool)
-
Declaration
Swift
case isSelected(_: Bool)
-
Declaration
Swift
case label(_: Comparison, _: String)
-
Declaration
Swift
case identifier(_: String)
-
Declaration
Swift
case type(_: XCUIElement.ElementType)
-
Declaration
Swift
case other(_: String)
-
Declaration
Swift
public init?(rawValue: PredicateRawValue)
-
Declaration
Swift
public var rawValue: PredicateRawValue { get }
-
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
-
reverse the semantics of predicates
Declaration
Swift
public var not: EasyPredicate { get }