Easy to write auto layout constraints, with minimal extensions to standard namespaces.
Constraints are added to a view using the view's layout
property, like so:
myView.layout.width(400)
Multiple constraints are easily added by chaining calls:
myView.layout.width(400).height(200)
A more complicated example:
let container = UIView()
let child = UIView()
container.layout.fill(.safeArea)
child.layout
.fill(container, axis: .x, inset: 20)
.center(in: container, axis: .y, priority: .high)
.top(.lessOrEqual, to: container, offset: 100)
.height(toWidth: 0.5)
The WWLayout Package URL is:
https://github.com/ww-tech/wwlayout.git
Add the package dependency to your Xcode project using the File
-> Swift Packages
-> Add Package Dependency...
menu item.
Simply add WWLayout to your Podfile
:
pod 'WWLayout'
WWLayout is © copyright by WW International.
WWLayout is licensed under the Apache-2.0 Open Source license.
link |
Stars: 52 |
Last commit: 46 weeks ago |
fill
where the inset
param is UIEdgeInsets
Thanks to Hasan Gücüyener @Osein!Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics