PrettyRawRepresentable
public protocol PrettyRawRepresentable : RawRepresentable where Self.RawValue == String
MARK: - pretty RawRepresentable as a keypath string of object
NOTE: the priority level
DefineRawValue > FollowPrettyProtocolButNotDefineRawValue > NoProtocolAndNoDefine
check the result as follow case:
struct AccessibilityID {
enum Home1: String {
case setting = "HomeSetting1"
}
enum Home2: String, PrettyRawRepresentable {
case setting
}
enum Home3: String, PrettyRawRepresentable {
case setting = "HomeSetting3"
}
}
let path1 = AccessibilityID.Home1.setting.rawValue
// "HomeSetting1"
let path2_1 = AccessibilityID.Home2.setting.rawValue
// "setting"
let path2_2 = AccessibilityID.Home2.setting.prettyRawValue
// "AccessibilityID_Home2_setting"
let path3 = AccessibilityID.Home3.setting.prettyRawValue
// "HomeSetting3"
-
prettyRawValue
Default implementationDefault Implementation
Declaration
Swift
var prettyRawValue: RawValue { get }
-
element
Extension methodget the element from app’s ui hierarchy with prettyRawValue
Declaration
Swift
var element: XCUIElement { get }
-
query
Extension methodquery elements from prettyRawValue
Declaration
Swift
var query: XCUIElementQuery { get }
-
count
Extension methodcount of prettyRawValue identifier
Declaration
Swift
var count: Int { get }
-
subscript(_:)
Extension methodSpecify the element with the subscript
Declaration
Swift
subscript(i: Int) -> XCUIElement { get }
Parameters
i
index
-
queryFor(identifier:)
Extension methodget the query from app’s ui hierarchy with prettyRawValue
Declaration
Swift
func queryFor(identifier: Self) -> XCUIElementQuery
Parameters
identifier
rawValue to convert to ID for search
Return Value
query result