Skip to content
This repository has been archived by the owner on Nov 27, 2018. It is now read-only.

Simple Pattern

dhemery edited this page Apr 9, 2012 · 33 revisions

A simple pattern assesses an individual view against a single criterion.

Types of simple patterns. There are four simple patterns:

Combining simple patterns. Simple patterns may be combined to form instance patterns that assess multiple criteria.

Class Pattern

A class pattern matches a view whose class meets specified criteria.

  • cmember of class pattern — matches a view that is an instance of the class named c.

  • c*kind of class pattern — matches a view that is an instance of the class named c or is an instance of a subclass of the class named c.

  • *universal pattern — matches a view of any class.

Identifier Pattern

An identifier pattern matches a view based on the value of an "identifier" property.

  • #itag identifier pattern — matches a view with a tag property whose value is equal to the integer i.

  • #sidentifier string pattern — matches a view with an accessibilityIdentifier property whose value is equal to the string s.

  • #widentifier word pattern — matches a view with an accessibilityIdentifier property whose value is equal to the word w.

Predicate Pattern

A predicate pattern matches a view that satisfies a predicate expression.

  • [p]predicate pattern — matches a view that satisfies predicate expression p.

Position Pattern

A position pattern matches a view that bears a specified relationship to its superview, subviews, or sibling views.

  • :root — matches a view that is the root view in the visible window.

  • :empty — matches a view that has no subviews.

  • :first-child — matches a view that is the first child of its superview.

  • :last-child — matches a view that is the last child of its superview.

  • :only-child — matches a view that is the only child of its superview.

  • :first-of-type — TBD

  • :last-of-type — TBD

  • :only-of-type — TBD

In the following patterns, r is a repeater.

  • :nth-child(r) — TBD

  • :nth-last-child(r) — TBD

  • :nth-of-type(r) — TBD

  • :nth-last-of-type(r) — TBD

Clone this wiki locally