Predicates

The last two examples in the previous section uses relationship rules with comparisons. These are also called predicates, an affirmation of the way a relation works between view elements. Predicates appear in parentheses. For example, you might specify that the size of a view is at least 50 points by using the following format:

[view1(>=50)]

This predicate relates to a single view. Notice that it is included within the view’s square brackets rather than as part of a connection between views. You’re not limited to a single request. For example, you might use a similar approach to let a view’s size range between 50 and 70 points. When adding compound predicates, separate the parts of your rule with commas:

[view1(>=50, <=70)]

Relative ...

Get The Core iOS Developer’s Cookbook, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.