Search code examples
xcodecalayerui-automationxcuitest

CALayer has no AccessibilityIdentifier


I have built a proof of concept that creates a CAShapeLayer object and I am able to set it's AccessibilityLabel correctly. However, I am unable to set an AccessibilityIdentifier (it seems this property exists for UIView objects, but not for CALayer objects?).

Does anyone know how to access it for CALayer objects - or if it is even possible?


Solution

  • Alladinian's suggestion above worked perfectly:

    "I haven't tried it in practice, but you could adopt UIAccessibilityIdentification protocol and implement accessibilityIdentifier if you have subclassed the CALayer or even adopt the protocol in an extension of CALayer and return its name for example."