-
Notifications
You must be signed in to change notification settings - Fork 5
Relationship Pattern
A relationship pattern is a sequence of subject patterns separated by combinators.

Subjects. By default, the subjects of a relationship pattern are the subjects of the last subject pattern in the relationship pattern.
A subject pattern is any pattern that can be related by a combinator. There are two kinds of subject patterns: instance patterns and branch patterns.


A combinator is punctuation that represents a relationship between two views. Whitespace may appear on either side of a combinator.
-
s1 s2— descendant combinator — matches a views2that is a descendant of views1. The combinator is the whitespace betweens1ands2. -
s1>s2— child combinator — matches a views2that is a subview of views1. -
s1~s2— sibling combinator — matches a views2that has a sibling views1.
A branch pattern is a relationship pattern enclosed in parentheses.

-
(s1 s2)— matches a views1that has a descendant views2.
Subjects. A branch pattern's subjects are the subjects of the first subject pattern in the enclosed relationship pattern.