Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor improvements and fixes to Cartography #278

Merged
merged 6 commits into from
Nov 22, 2017
Merged

Conversation

corujautx
Copy link
Contributor

@corujautx corujautx commented Nov 22, 2017

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 NSLayoutGuides 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 by view.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

This change makes sure the `isActive` requirement gets compiled because
the changes implemented in Cartography 3.0 make use of that API
This allows a more expressive use of edges insetting, as it moves the
current function to be a member of `Edges` itself.

e.g. `view.edges == inset(view.superview!.edges, 10)` can now be
written as `view.edges == view.superview!.edges.inseted(by: 10)` which
is a lot more expressive

This commit does not break the current implementation of the `inset`
function, only adds this cosmetic change that allows more expressivity
@corujautx
Copy link
Contributor Author

@orta could you please check this? Thanks!

@orta
Copy link
Collaborator

orta commented Nov 22, 2017

Yeah, this looks good to me - thanks for the comprehensive PR text too - will ship a release now

@orta orta merged commit b7b9271 into robb:master Nov 22, 2017
@orta
Copy link
Collaborator

orta commented Nov 22, 2017

screen shot 2017-11-22 at 10 38 35 am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants