FlightLayout alternatives and similar libraries
Based on the "Layout" category.
Alternatively, view FlightLayout 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 -
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+ -
ManualLayout
✂ Easy to use and flexible library for manually laying out views and layers for iOS and tvOS. Supports AsyncDisplayKit. -
QuickLayout
Written in pure Swift, QuickLayout offers a simple and easy way to manage Auto Layout in code. -
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 FlightLayout or a related project?
README
FlightLayout
Introduction
FlightLayout is a light weight, and easy to learn layout framework as an extension of the UIView. Functionally, it lives somewhere in between the manual process of laying out views from the old days, and the flexibility of Autolayout's dynamic constraint approach.
Some use cases for this framework include the ability to animate views with core animation. Without the overhead of Autolayout's constraints system, we are free to apply animations without the hassle of disabling constraints to perform parametric animations to a layer's properties.
Demo
Since the scope of the documentation is limited to a handful of examples, once you have finished with the reading the documentation below, feel free to clone the project and run the demo app with the project. The demo app provides the ability to pick different options in the method call, once selected, the app will align a demo view on the screen to it's final frame, and provide a code example to reflect it.
An example of how the view controller is laid out in the demo app is can be found here
Installation
Basic Use
The UIView Extension which contains the align
method, when called by a view, the calling view will set it's own frame relatively as specified by the parameters in the method call . The method constraints 6 optional parameters with assigned defaults, thus creating very powerful and flexible method signature with lots of possibilities. See below for an in-depth examples below for definitions of each parameter.
There are two enumerators defined for horizontal and vertical alignment. These are the magic options that allow you to align the calling view relative to another frame.
func align(toFrame frame : CGRect? = nil,
withSize size : CGSize? = nil,
horizontal : HorizontalAlign,
vertical : VerticalAlign,
horizontalOffset : CGFloat = 0.0,
verticalOffset : CGFloat = 0.0)
When performing animations, there often comes a need to calculate the frame to perform an animation. The following method returns a pre-calculate the frame based on the method parameters included, without actually setting it on the calling view. The align
method actually this to calculate it's final value.
func rectAligned(toFrame frame : CGRect = CGRectZero,
withSize size : CGSize? = nil,
horizontal : HorizontalAlign,
vertical : VerticalAlign,
horizontalOffset : CGFloat = 0.0,
verticalOffset : CGFloat = 0.0) -> CGRect
Horizontal Alignment
The following horizontal options align the calling view on the horizontal plane, with illustrations below
public enum HorizontalAlign {
case left // Align horizontally to the Left
case leftEdge // Align horizontally to the Left Edge
case center // Align center.y horizontally
case rightEdge // Align horizontally to the Right Edge
case right // Align horizontally to the Right
}
Vertical Alignment
The vertical options align the calling view on the vertical plane, with illustrations below
public enum VerticalAlign {
case above // Align vertically Above
case top // Align vertically to the top
case center // Align center.y vertically
case base // Align vertically to the base
case below // Align vertically Below
}
Example 1
In the following example, first we add the a new view named bigView as a subview, and say you want to align it dead center relative to the superview's bounds. It's as calling align against the view with the following method. This call with align the big bigView against the view's bounds that it was added to, with a horizontal, and vertical, alignment of .center
.
view.addSubview(bigView)
bigView.align(toFrame : view.bounds,
withSize : CGSize(width : 140.0, height : 140.0),
horizontal : .center,
vertical : .center)
Note: In the case that the calculated frame is the same as the calling views frame, it will not actually set the frame on the caller, it will just exit. This helps avoid glitches during animations, i.e setting the frame on the view that is currently animating, will flicker the view to it's final position.
Example 2
The call in Example 1 can also be expressed by omitting toFrame parameter. In the absence of the toFrame parameter from the method call, the framework automatically assumes that you are intending to align the calling view against the it's superview's bounds.
view.addSubview(bigView)
bigView.align(withSize : CGSize(width : 140.0, height : 140.0),
horizontal : .center,
vertical : .center)
Example 3
What if we implemented a sizeToFit()
method on our calling view. In the absence of the withSize parameter from the method call, the framework automatically assumes that you are intending to use the current size of the calling view.
view.addSubview(bigView)
bigView.sizeToFit()
bigView.align(horizontal : .center,
vertical : .center)
Example 4
The above example, can also be expressed by omitting horizontal and vertical parameters. In the absence of the horizontal and vertical parameters from the method call, the framework automatically assumes that you are intending to align the calling view's to the center horizontally, and vertically, by defaulting to .Center
.
view.addSubview(bigView)
bigView.sizeToFit()
bigView.align()
Horizontal & Vertical Offset
The horizontalOffset and verticalOffset parameters adjust the calling view's final frame on the horizontal and vertical alignment parameters.
Lets assume we want to center the view and adjust it 20px right, and 20px upward. We can do this by including the horizontalOffset and verticalOffset and update the offset as follows.
view.addSubview(bigView)
bigView.sizeToFit()
bigView.align(horizontal : .center,
vertical : .center,
horizontalOffset : 20.0,
verticalOffset : -20.0)
License
The MIT License (MIT)
Copyright (c) 2016 Anton Doudarev
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*Note that all licence references and agreements mentioned in the FlightLayout README section above
are relevant to that project's source code only.