EZAnchor
An easier way to code Autolayout
- [x] Are you annoyed of coding
.active = true
while using Autolayout Anchors over and over again? - [x] Are you annoyed of coding such long constraint sentence
refreshView.heightAnchor.constraint(equalToConstant: self.refreshViewHeight).isActive = true
over and over again?
Now EZAnchor
is definitely going to shorten your time of writing Autolayout Anchors by a simple installation.
Let's see how it works:
- Anchor constraint to another anchor
- Anchor constraint to another anchor with constant
- Anchor constraint to another anchor with negative constant
- Anchor lessThanOrEqualTo another anchor
- Anchor greaterThanOrEqualTo another anchor
- Anchor lessThanOrEqualTo another anchor with constant
- Anchor greaterThanOrEqualTo another anchor with constant
- Anchor equalTo another anchor with constant and multiplier
- Work with Priority
Installation
Drag and drop
Directly drag EZAnchor
and drop into your Xcode project.
CocoaPods
To integrate EZAnchor into your Xcode project using CocoaPods, specify it in your Podfile:
target 'MyApp' do
pod 'EZAnchor'
end
Carthage
To integrate EZAnchor into your Xcode project using Carthage, specify it in your Cartfile:
coming soon
Run carthage update to build the framework and drag the built EZAnchor.framework into your Xcode project.
Demo
You can easily implement the following layout with very simple and clean code:
Chaining function
Chaining way to code Autolayout with EZAnchor
Limitations
-
Better to have some basic concept of anchors, familiar with coding anchors programmatically. If not please learn from this link : Programmatically Creating Constraints!
-
Avoid defining custom
UIControl
or view has same name withheight
orwidth
, there may have conflict withEZAnchor
library
Others
WTF Autolayout will help you debug autolayout complaints.
Logo is generated with Shopify logo maker
Inspired by: PureLayout Stevia layout
Todo
- [ ] Unit tests
- [ ] UI Tests
- [ ] CI
- [ ] Fastlane
License
This code and tool is under the MIT License.