// place subview on view an pin all edges i.e. top, bottom, leading, trailing
subview.place(on: view).pin(.allEdges)
// as above with padding
subview.place(on: view).pin(.allEdges(padding: 20))
// as above with no padding and using specific parameters
subview.place(on: view).pin(.top, .leading, .trailing, .bottom)
// if you don't want to chain constraints after placement, simply place first
subview.place(on: view)
// pin top edge to a different views bottom with padding
subview.pin(.top(to: anotherView, .bottom, padding: 10))
// pin horizontal edges to superview
subview.pin(.horizontalEdges)
// pinning top and bottom edges to layout guide and to superview leading and trailing
subview.pin(.top(to: view.safeAreaLayoutGuide),
.bottom(to: view.safeAreaLayoutGuide),
.leading,
.trailing)
// pinning fixed height and width in center of superview
subview.pin(.fixedHeight(50), .fixedWidth(50), .centerX, .centerY)
-
Notifications
You must be signed in to change notification settings - Fork 0
mgopsill/MGLayout
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
A simple wrapper for programmatic layouts
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published