Protocols

The following protocols are available globally.

  • 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"
    
    See more

    Declaration

    Swift

    public protocol PrettyRawRepresentable : RawRepresentable where Self.RawValue == String
  • Use generic protocols to better extend functionality in both engineering and testing projects

    // for project
    extension XCUIElement: PredicateBaseExtensionProtocol {
       public typealias T = XCUIElement
    }
    
    // for test
    extension EasyPredicateTestItem: PredicateBaseExtensionProtocol {
       typealias T = EasyPredicateTestItem
    }
    
    See more

    Declaration

    Swift

    public protocol PredicateBaseExtensionProtocol