FormationLayout alternatives and similar libraries
Based on the "Layout" category.
Alternatively, view FormationLayout alternatives based on common mentions on social networks and blogs.
-
Masonry
Harness the power of AutoLayout NSLayoutConstraints with a simplified, chainable and expressive syntax. Supports iOS and OSX Auto Layout -
FDTemplateLayoutCell
Template auto layout cell for automatically UITableViewCell height calculating -
PureLayout
The ultimate API for iOS & OS X Auto Layout — impressively simple, immensely powerful. Objective-C and Swift compatible. -
Cartography
A declarative Auto Layout DSL for Swift :iphone::triangular_ruler: -
MyLinearLayout
MyLayout is a powerful iOS UI framework implemented by Objective-C. It integrates the functions with Android Layout,iOS AutoLayout,SizeClass, HTML CSS float and flexbox and bootstrap. So you can use LinearLayout,RelativeLayout,FrameLayout,TableLayout,FlowLayout,FloatLayout,PathLayout,GridLayout,LayoutSizeClass to build your App 自动布局 UIView UITableView UICollectionView RTL -
DeviceKit
DeviceKit is a value-type replacement of UIDevice. -
LayoutKit
LayoutKit is a fast view layout library for iOS, macOS, and tvOS. -
PinLayout
Fast Swift Views layouting without auto layout. No magic, pure code, full control and blazing fast. Concise syntax, intuitive, readable & chainable. [iOS/macOS/tvOS/CALayer] -
FlexLayout
FlexLayout adds a nice Swift interface to the highly optimized facebook/yoga flexbox implementation. Concise, intuitive & chainable syntax. -
Device
Light weight tool for detecting the current device and screen size written in swift. -
FLKAutoLayout
UIView category which makes it easy to create layout constraints in code -
set-simulator-location
CLI for setting location in the iOS simulator -
Compose
Compose is a library that helps you compose complex and dynamic views. -
Anchorage
A collection of operators and utilities that simplify iOS layout code. -
Relayout
Swift microframework for declaring Auto Layout constraints functionally -
UIDeviceComplete
UIDevice extensions that fill in the missing pieces. -
Luminous
Luminous provides you a lot of information about the system and a lot of handy methods to quickly get useful data on the iOS platform. -
MisterFusion
MisterFusion is Swift DSL for AutoLayout. It is the extremely clear, but concise syntax, in addition, can be used in both Swift and Objective-C. Support Safe Area and Size Class. -
Cupcake
An easy way to create and layout UI components for iOS (Swift version). -
Anchors
Declarative, extensible, powerful Auto Layout for iOS 8+ and macOS 10.10+ -
QuickLayout
Written in pure Swift, QuickLayout offers a simple and easy way to manage Auto Layout in code. -
ManualLayout
✂ Easy to use and flexible library for manually laying out views and layers for iOS and tvOS. Supports AsyncDisplayKit. -
TapticEngine
TapticEngine generates haptic feedback vibrations on iOS device. -
WatchShaker
Simple motion detector for ⌚️ (watchOS) shake gesture. -
MondrianLayout
🏗 A way to build AutoLayout rapidly than using InterfaceBuilder(XIB, Storyboard) in iOS. -
BBLocationManager
A Location Manager for easily implementing location services & geofencing in iOS. Ready for iOS 11. -
Framezilla
Elegant library that wraps working with frames with a nice chaining syntax. -
Anchorman
An autolayout library for the damn fine citizens of San Diego. -
Auto Layout Magic
Build 1 scene, let AutoLayoutMagic generate the constraints for you!
Appwrite - The Open Source Firebase alternative introduces iOS support
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of FormationLayout or a related project?
README
FormationLayout
Documentation
FormationLayout
is the top level layout class for one root view.
FormationLayout
takes aUIView
as itsrootView
.translatesAutoresizingMaskIntoConstraints
ofrootView
is not set to false by default but can be set in constructor.translatesAutoresizingMaskIntoConstraints
of subviews will be set to false automaticly.- Subviews with no
superView
will be added torootView
automaticly.
demo { canvas, icon in
FormationLayout(rootView: canvas)[icon].center(equalTo: canvas)
}
Anchors
View anchors: left, right, top, bottom, leading, trailing, width, height, centerX, centerY, lastBaseline, firstBaseline, centerXWithinMargins, centerYWithinMargins
layout[view].anchor(equalTo: view2, multiplyBy: multiplier, plus: constant)
- view.anchor == view2.anchor * multiplier + constant
layout[view].anchor(equalTo: anchor2, of: view2, multiplyBy: multiplier, minus: constant)
- view.anchor == view2.anchor2 * multiplier - constant
layout[view].anchor(greaterThanOrEqualTo: view2)
- view.anchor >= view2.anchor
layout[view].anchor(lessThanOrEqualTo: value)
(Only width and height)- view.anchor <= value
demo { canvas, icon1, icon2, icon3 in
let layout = FormationLayout(rootView: canvas)
layout[icon1].top(equalTo: canvas, plus: 10).leading(equalTo: canvas, plus: 20)
layout[icon2].top(equalTo: icon1).leading(equalTo: .trailing, of: icon1, plus: 10)
layout[icon3].bottom(equalTo: canvas, minus: 10).leading(equalTo: icon1, multiplyBy: 2)
}
Helpers
- aspectRatio:
width:height
- size: width & height
- center: centerX & centerY
demo { canvas, icon1, icon2, icon3 in
let layout = FormationLayout(rootView: canvas)
layout[icon1].aspectRatio(equalTo: 1.5).width(equalTo: 30)
layout[icon2].size(equalTo: 30).center(equalTo: canvas, multiplyBy: 0.8)
layout[icon3].size(equalTo: icon2, minus: 10).center(equalTo: icon2, plus: 30)
}
Pin
layout[view].pin(to: canvas)
will set
- view.top == canvas.top
- view.bottom == canvas.bottom
- view.left == canvas.left
- view.right == canvas.right
layout[view].pin(to: canvas, margin: 10)
will set
- view.top == canvas.top + 10
- view.bottom == canvas.bottom - 10
- view.left == canvas.left + 10
- view.right == canvas.right - 10
demo { canvas, icon1, icon2, icon3 in
let layout = FormationLayout(rootView: canvas)
layout[icon1].pin(to: canvas, edgesWithMargin: [.top: 10, .leading: 3])
layout[icon2].pin(to: canvas, margin: 30)
layout[icon3].pin(to: canvas, edges: [.topBottom, .trailing], margin: 3)
}
Abreast
- layout[logo].below(topLayoutGuide, gap: 10)
- logo.top == topLayoutGuide.bottom + 10
- layout[copyright].above(bottomLayoutGuide, gap: 10)
- copyright.bottom == bottomLayoutGuide.top - 10
demo { canvas, icon1, icon2, icon3 in
let layout = FormationLayout(rootView: canvas)
layout[icon1].center(equalTo: canvas)
layout[icon2].before(icon1).above(icon1, gap: 5)
layout[icon3].after(icon1).below(icon1, gap: 5)
}
Group
layout.group(view1, view2)
will create same constraints for
- layout[view1]
- layout[view2]
demo { canvas, icon1, icon2, icon3 in
let layout = FormationLayout(rootView: canvas)
layout.group(icon1, icon2, icon3).centerY(equalTo: canvas)
layout[icon1].leading(equalTo: canvas, plus: 5)
layout[icon2].centerX(equalTo: canvas)
layout[icon3].trailing(equalTo: canvas, minus: 5)
}
Condition
layout.when()
creates constraints for one condition and its not
creates constrains for otherwise.
demo { canvas, icon in
var isLoggedIn = true
let layout = FormationLayout(rootView: canvas)
let loggedInLayout = layout.when { isLoggedIn }
layout[icon].centerX(equalTo: canvas)
loggedInLayout[icon].top(equalTo: canvas, plus: 10)
loggedInLayout.not[icon].bottom(equalTo: canvas, minus: 10)
layout.update()
}
isLoggedIn = false
Priority
All constraints have UILayoutPriorityRequired by default.
demo { canvas, icon in
let layout = FormationLayout(rootView: canvas)
layout[icon].centerX(equalTo: canvas).size(equalTo: 20)
.centerY(equalTo: canvas, at: UILayoutPriorityDefaultLow) // Try UILayoutPriorityRequired
.bottom(equalTo: canvas, at: UILayoutPriorityDefaultHigh)
}
UILayoutPriorityRequired:
Playground
- Open Documentation/Doc.xcworkspace.
- Build the FormationLayout-iOS scheme (⌘+B).
- Open Doc playground in the Project navigator.
- Click "Show Result" button at the most right side of each
demo
line.
Install
CocoaPods
pod 'FormationLayout', '~> 0.8.5'
Carthage
github "evan-liu/FormationLayout" >= 0.8.5
*Note that all licence references and agreements mentioned in the FormationLayout README section above
are relevant to that project's source code only.