Minor improvements and fixes to Cartography #278
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR includes improvements and fixes to Cartography 3.0
Discontinuation of the support for macOS < 10.10: The reason I did this is because Cartography 3.0 makes use of the
isActive
property on constraints and no longer has views to attach to a context like in previous versions, as those contained traversal of view hierarchy to identify where to attach a constraint as previous APIs did. It makes no sense to support 10.9 because Cartography is already targeted to iOS 8.0 onwards which supports this new API. This should "fix" Xcode9: Cartography (3.0.0) fails to compile with Swift 4 for macOS #274.Extending support to NSLayoutGuide: A missing feature in the release of Cartography 3.0 was the support of
NSLayoutGuide
s in macOS. This is now supported!Improvements to insetting edges: I added a more expressive way to inset edges in expressions. The way you would currently do this would be expressing
view.edges == inset(view.superview!.edges, 10)
which would now can also be expressed byview.edges == view.superview!.edges.inseted(by: 10)
which makes a lot more expressive.Supporting other layout guides included in UIView:
UIView
also includes references to other layout guides that are used to define standard layout margins or readable content margins. These now can be used in Cartography by expressing for example:view.edges == view.superview!.readableContentGuide.edges