Macros

Listing 5-1 shows a comprehensive set of macro definitions. These have been tested and are used in many recipes in this book, although they approach constraints in a fairly simple manner. Note that these macros do not return the constraints but actually add the constraints to the appropriate view. If you need to maintain access to newly created constraints for later removal, you can easily add macros that return the constraints or use the functionality in Recipe 5-1 to locate and remove constraints.

Another addition is not included in Listing 5-1 due to space limitations but is occasionally handy: variants that accept constraint constants. Such a variant can be particularly useful when aligning views to their parent and is trivial to add ...

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.