SMBCheeky

3pods

SnapConstraints

ALL YOU NEED TO DO IS .snap ;)

Useful information ahead:

  • Constraints are added as soon as they are created.
  • Views who are subject to SnapConstraints have .translatesAutoresizingMaskIntoConstraints set to false automatically.
  • This framework is optimized to hide as many negative values as possible. If a constraint is not shown properly, try setting the constant as a negative value, and maybe check if you are using the correct type of SnapConstraint.
  • The SnapManager contains internal logging and SnapConstraints options. Please modify as you wish.
  • The framework is build around SnapConstraintTypes and constraints can be created by accessing any child of UIView, and using the variable '.snap' to initiate the chaining of constraints and mask. Yup, chaining and masks, you heard right.
  • All constraints created can be retrieved immediately by using the .snaps methods on the view they are added to.

Future work:

This framework allows you to do a lot of things, but most importantly, it will signal, in the near future, when you are trying to do something prohibited by your view hierarchy, and most of the time, it will help you do it in a safe way ;). Some of the issues are: 1. 1000/999 priority changes 2. multiplier change after the creation of a constraint 3. ... and more to come

License: Apache-2.0

  • Swift