I often find I have optional constraints (left vs right anchoring, size switches, optional UI elements, etc.) Especially in table view cells. I changed the above code to allow me to write layouts like so:
This change is so I don't have to have lists of optional constraints (i.e. separate calls to AddConstraints() ) after the core set of constraints - that are then separated by many lines of code and if blocks. I was also debating adding my own custom constraints - which when they were not needed would return null. Something like BelowIfExists(this UIView view, UIView previous, float margin = 0f)
Not sure if the allowing of nulls in lists of constraints fits the rest of the design though :)
I often find I have optional constraints (left vs right anchoring, size switches, optional UI elements, etc.) Especially in table view cells. I changed the above code to allow me to write layouts like so:
This change is so I don't have to have lists of optional constraints (i.e. separate calls to AddConstraints() ) after the core set of constraints - that are then separated by many lines of code and if blocks. I was also debating adding my own custom constraints - which when they were not needed would return null. Something like BelowIfExists(this UIView view, UIView previous, float margin = 0f)
Not sure if the allowing of nulls in lists of constraints fits the rest of the design though :)