Rightpoint / Eject

An eject button for Interface Builder to generate swift code
MIT License
522 stars 24 forks source link

Use Anchorage edge shorthand where possible #23

Open ZevEisenberg opened 7 years ago

ZevEisenberg commented 7 years ago

verticalAnchors, horizontalAnchors, and edgeAnchors should all be used if possible.

KingOfBrian commented 7 years ago

Good idea! I think I may add an analysis pass after the CodeGenerators are populated in the XIBDocument. This could do the duplicate variable name detection, and coalesce ConstraintCodeGenerator to use the edge shorthands.

KingOfBrian commented 7 years ago

Should be able to follow a pattern like this to scan statements for 2 or 4 matching generators and replace them with the compound anchors.

https://github.com/Raizlabs/Eject/blob/master/EjectKit/Builder/ActionBuilder.swift#L37

ZevEisenberg commented 7 years ago

Now we have centerAnchors as well.