UIView category which makes it easy to create layout constraints in code

Related tags

Layout FLKAutoLayout
Overview

FLKAutoLayout

FLKAutoLayout is a collection of categories on UIView which makes it easy to setup layout constraints in code.

FLKAutoLayout creates simple constraints with a readable syntax and provides many convenience methods to setup more complex constraints between multiple views at once. It automatically adds the constraints to the nearest common superview of the views involved and sets the translatesAutoresizingMaskIntoConstraints property on those views to NO.

FLKAutoLayout provides methods on UIView instances for simple layout constraints like width and height or constraining an edge of one view to another. Furthermore it provides methods on the UIView class for more complex layout constraints where more than two views are involved.

For some examples of how to setup constraints please check the example project.

Example

Let's assume we have a bunch of labels and an equal amount of textFields and we want to align them nicely in a grid like manner:

// align the first label with its superview
[labels[0] alignTop:@"20" leading:@"20" toView:labels[0].superview];
// give it a minimum width of 200 and a maximum width of 300
[labels[0] constrainWidth:@">=200,<=300"];
// now constrain all labels to this size
[UIView alignLeadingAndTrailingEdgesOfViews:labels];
// space the labels out vertically with 10 points in between
[UIView spaceOutViewsVertically:labels predicate:@"10"];

// now let's take care of the text fields.
// the first one has a fixed space of 20 to its label
[textFields[0] constrainLeadingSpaceToView:labels[0] predicate:@"20"];
// constrain the right edge to its superview with 20 points padding
[textFields[0] alignTrailingEdgeWithView:textFields[0].superview predicate:@"20"];
// constrain all other text fields to the same width
[UIView alignLeadingAndTrailingEdgesOfViews:textFields];
// and finally let's align the baseline of each label with the baseline of each text field
[UIView alignAttribute:NSLayoutAttributeBaseline ofViews:labels toViews:textFields predicate:@"0"];

FLKAutoLayout instance methods

FLKAutoLayout extends UIView instances with methods to setup simple constraints in a readable form.

Aligning edges of one view to another:

// constrain the leading edge of the view to the leading edge of another
[view alignLeadingEdgeWithView:otherView predicate:@"0"];

// same as before but use a 20 point offset
[view alignLeadingEdgeWithView:otherView predicate:@"20"];

// same as before but give this constraint a priority of 750
[view alignLeadingEdgeWithView:otherView predicate:@"20@750"];

// aligning some other edge types
[view alignTopEdgeWithView:otherView predicate:@"0"];
[view alignBottomEdgeWithView:otherView predicate:@"0"];
[view alignTrailingEdgeWithView:otherView predicate:@"0"];
[view alignBaselineWithView:otherView predicate:@"0"];
[view alignCenterXWithView:otherView predicate:@"0"];
[view alignCenterYWithView:otherView predicate:@"0"];

// centering two views
[view alignCenterWithView:otherView];

Constraining view to another:

// constrain leading edge of the view to the trailing edge of the other
[view constrainLeadingSpaceToView:otherView predicate:@"0"];

// constrain trailing edge of the view to the leading edge of the other
[view constrainTrailingSpaceToView:otherView predicate:@"0"];

// constrain top edge of the view to the bottom edge of the other
[view constrainTopSpaceToView:otherView predicate:@"0"];

// constrain bottom edge of the view to the top edge of the other
[view constrainBottomSpaceToView:otherView predicate:@"0"];

Constraining width & height:

[view constrainWidth:@"400"];
[view constrainHeight:@"300"];
// or combined:
[view constrainWidth:@"400" height:@"300"];
// or relative to another view
[view constrainWidthToView:otherView predicate:@"*.3"]; // 30% of otherView's width
[view constrainHeightToView:otherView predicate:@">=*.5"]; // at least 50% of otherView's height

Spacing out two views:

// creating a >=20 points space between the top edge of one view to the bottom edge of the other
[view constrainTopSpaceToView:otherView predicate:@">=20"];
// creating a >=20 points space between the leading edge of one view to the trailing edge of the other
[view constrainLeadingSpaceToView:otherView predicate:@">=20"];

If you need more control over which layout attribute of one view should be constrained to which layout attribute of another view, you can use a generic helper method:

[view alignAttribute:NSLayoutAttributeCenterX to Attribute:NSLayoutAttributeTrailing ofView:otherView predicate:@"20"];

Which reads succinctly in Swift

view.alignAttribute(.CenterX, toAttribute: .Trailing, ofView: otherView, predicate: "0")

FLKAutoLayout class methods

For laying out more than two views at once FLKAutoLayout provides extends UIView with some class methods.

Align multiple views at once:

// align all views in the views array along their leading edge
[UIView alignLeadingEdgesOfViews:views];
// align all views in the views array along their bottom edge
[UIView alignBottomEdgesOfViews:views];
// see UIView+FLKAutoLayout.h for more...

Constrain width and height of multiple views:

// constrain all views to the same height
[UIView equalHeightForViews:views];
// constrain all views to the same width
[UIView equalWidthForViews:views];

Spacing out multiple views:

// space out views horizontally with 20 points in between
[UIView spaceOutViewsHorizontally:views predicate:@"20"];
// space out views vertically with no space in between
[UIView spaceOutViewsVertically:views predicate:@"0"];

// Distribute views according to their horizontal center
[UIView distributeCenterXOfViews:views inView:containerView];
// Distribute views according to their vertical center
[UIView distributeCenterYOfViews:views inView:containerView];

Please note that distributing views at their centers will line up the center of the first view at the edge of the container view.

The predicate argument

Many of the methods take a predicate string which resembles the syntax Apple uses in their visual format language, extended by the possibiliy to also specify a multiplier.

[ == | >= | <= ] [ *multipler ] [ constant ] [ @priority ], ...

For example:

// greater than or equal to 300points, small then 500 points
[view constrainWidth:@">=300,<=500"];
// equal to 300 points
[view constrainWidth:@"300"];
// greater than or equal to 300 points with priority of 250
[view constrainWidth:@">=300@250"];

// greater than or equal to 1/2 of the otherView width
[view constrainWidthToView:otherView predicate:@">=*.5"];
// greater than or equal to 1/2 of the otherView width, smaller than or equal to 600 points with a priority of 100
[view constrainWidthToView:otherView predicate:@">=*.5,<=600@100"];

UILayoutGuide / FLKAutoLayoutGuide

If you are support OSes below iOS9 you can use the flk_topLayoutGuide and flk_bottomLayoutGuide to work with layout guides for your UIViewControllers.

- (void)viewWillLayoutSubviews
{
    [self.webView constrainTopSpaceToView:self.flk_topLayoutGuide predicate:@"0"];
    [self.webView alignLeading:@"0" trailing:@"0" toView:self.view];
    [self.webView alignBottomEdgeWithView:self.view predicate:@"0"];
}

For iOS9 and above you can use the UIKit methods.

Creator

Florian Kugler (@floriankugler).

License

FLKAutoLayout is available under the MIT license. See the LICENSE file for more info.

Comments
  • nil predicate not equal to @

    nil predicate not equal to @"0"

    the changes to FLKAutoLayout/UIView+FLKAutoLayout.m in commit c8f5ec0 should be reverted, imho.

    If you pass a nil predicate into any of the methods whose behaviour is changed there, it won't act like you actually passed @"0", but will actually not add any constraints at all, which is inconsistent with all the other methods.

    opened by ahti 12
  • Getting an existing NSLayoutConstraint

    Getting an existing NSLayoutConstraint

    Working with a graph bar I needed to update a constant to make an UIViewAnimation. FLKAutoLayout is amazing with adding but it lacks support for get or update constraints.

    Would be nice to be able to get an existing constraint by type just for update their constant or just maybe for delete and add again with new values.

    I've tried one snipped I found (not mine) http://stackoverflow.com/questions/13857115/getting-an-existing-nslayoutconstraint-for-the-width and it works perfectly.

    Awesome library anyway!!!

    opened by jordim 4
  • flk_autolayoutTrace fails submission in xcode 6.1.1

    flk_autolayoutTrace fails submission in xcode 6.1.1

    My app fails private api usage check when submitting with application loader and xcode. I removed the flk_autolayoutTrace method and it submitted with no issue. I have submitted this code in previous versions of xcode so must be a new thing

    opened by foulkesjohn 3
  • Constraint Methods Should Accept Format Strings

    Constraint Methods Should Accept Format Strings

    If I have certain UI constants, I should be able to pass those directly to the constraint methods as a predicate with printf-style specifiers.

    Currently, you need:

    {
      [view alignTopEdgeWithView:superview 
                       predicate:[NSString stringWithFormat:@"%@", [settings paddingFromTop]]];
    }
    

    Instead of the simpler:

    {
      [view alignTopEdgeWithView:superview predicate:@"%@", [settings paddingFromTop]];
    }
    
    opened by rhgills 3
  • Debug Autolayout constraints description

    Debug Autolayout constraints description

    UILayoutGuide was called as firstItem or secondItem. This class doesn't have UIView as class parent and won't have the method "-(NSString *)flk_nameTag" from the category "UIView+FLKAutoLayoutDebug.h".

    opened by Xodia 2
  • Suppress some warnings in Xcode

    Suppress some warnings in Xcode

    In my pull request I fixed 2 errors:

    1. UIView+FLKAutoLayout.m:240:28: Implicit conversion loses floating-point precision: 'double' to 'CGFloat' (aka 'float')
    2. UIView+FLKAutoLayoutPredicate.h:18:31: Unused function 'FLKAutoLayoutPredicateMake'
    opened by akashivskyy 2
  • Add View Hierarchy Traversal to Remove Constraints

    Add View Hierarchy Traversal to Remove Constraints

    removeConstraintsFromApplicableSuperview:

    Added removeConstraintsFromApplicableSuperview:, which traverses through all the superviews of the receiver to remove each passed constraint from the nearest superview that holds it. This means that you can remain blissfully unaware of which superview FLKAutoLayout is adding constraints to when constraining a view, yet still remove them by calling it on either of the views that you used to configure the constraints.

    I discovered the need for this method when implementing a container view controller. When that container switches the single contained view controller it holds, I wanted to remove all constraints it configured on the previously contained view controller's view before removing it from the view hierarchy. In this case, I use it as follows:

    - (void)makeViewControllerInactive:(UIViewController *)theViewController;
    {
        [theViewController  willMoveToParentViewController:nil];
    
        // NB: There is no need to explicitly remove constraints applying to a view that you are removing from the view hierarchy. Constraints will be removed automatically when removing that view.
        [[inactiveViewController view] removeConstraintsFromApplicableSuperview:self.    activeViewControllerPositioningConstraints];
        self.activeViewControllerPositioningConstraints = nil;
    
        [[theViewController view] removeFromSuperview];
        [theViewController removeFromParentViewController];
    }
    

    When setting constraints on the activeViewController in updateViewConstraints, I populate the array of activeViewControllerPositioningConstraints.

    Unit Tests

    I also took the opportunity to add a unit test target and wrote some tests to drive out the implementation of removeConstraintsFromApplicableSuperview:. Hopefully this will encourage others to improve the test coverage going forward.

    Repo Structure

    And, as part of adding the unit test target, I messed with the repository directory structure a bit (hopefully for the better). I hope I'm not stepping on your toes too much here. Please do let me know your thoughts on both the organizational changes I made and the more substantial ones.

    opened by rhgills 2
  • Fixes TODOs from #45

    Fixes TODOs from #45

    Mainly:

    • Ensures Carthage works fine
    • Fixes some typoes
    • Fixes #40
    • Merges #44 but then undoes it, as the work is done elsewhere
    • Changes license to be a time-range, which is what we do at Artsy
    • Removes source-code banners, leaving the LICENSE/README to do the talking
    • Updates the README about nullability, and adds a layout guides section
    opened by orta 1
  • Modernize for 2016

    Modernize for 2016

    Main changes:

    • Uses pod lib create template for project, which means free carthage support https://github.com/floriankugler/FLKAutoLayout/pull/32
    • Contains fixes for a lot of PRs:
      • fixes https://github.com/floriankugler/FLKAutoLayout/pull/43
      • fixes https://github.com/floriankugler/FLKAutoLayout/pull/34
      • https://github.com/floriankugler/FLKAutoLayout/pull/28
      • https://github.com/floriankugler/FLKAutoLayout/pull/26
    • forced nonnull on predicates, our biggest source of Artsy's Auto-Layout bugs
    • tightened up the types to be lightweight generics, and made anything that really returns one predicate only return that predicate in the public API
    • added comments throughout the public API for extra CocoaDocs points
    • adds support for an iOS7/iOS8 compatible UILayoutGuide

    TODO before merging:

    • [ ] Update README for these changes
    • [ ] Remove the code comments at the top of source files, this is an Artsy convention - contributors still get their credit via the GitHub API
    • [ ] Give it all an extra look over
    opened by orta 1
  • Don't crash on invalid constraints

    Don't crash on invalid constraints

    Fixes exceptions of the sort:

    -[UILayoutGuide flk_nameTag]: unrecognized selector sent to instance 0x7ffe2bff9470 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UILayoutGuide flk_nameTag]: unrecognized selector sent to instance 0x7ffe2bff9470' *** First throw call stack: ( 0 CoreFoundation 0x000000010c6acd85 exceptionPreprocess + 165 1 libobjc.A.dylib 0x000000010c120deb objc_exception_throw + 48 2 CoreFoundation 0x000000010c6b5d3d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205 3 CoreFoundation 0x000000010c5fbcfa __forwarding + 970 4 CoreFoundation 0x000000010c5fb8a8 _CF_forwarding_prep_0 + 120 5 FLKAutoLayout 0x0000000109046958 -[NSLayoutConstraint(FLKAutoLayoutDebug) description] + 168 6 CoreFoundation 0x000000010c69cd28 -[NSArray descriptionWithLocale:indent:] + 344 7 Foundation 0x000000010906c5fc _NSDescriptionWithLocaleFunc + 64 8 CoreFoundation 0x000000010c598bdc __CFStringAppendFormatCore + 9708 9 CoreFoundation 0x000000010c688a03 _CFStringCreateWithFormatAndArgumentsAux2 + 259 10 CoreFoundation 0x000000010c69993a _CFLogvEx2 + 154 11 CoreFoundation 0x000000010c699a9b _CFLogvEx3 + 171 12 Foundation 0x0000000109143b1e _NSLogv + 117 13 Foundation 0x0000000109092822 NSLog + 152 14 UIKit 0x000000010b0a3885 UIViewAlertForUnsatisfiableConstraints + 779 15 UIKit 0x000000010b0a3966 -[UIView(UIConstraintBasedLayout_EngineDelegate) engine:willBreakConstraint:dueToMutuallyExclusiveConstraints:] + 113 16 Foundation 0x000000010923debf -[NSISEngine handleUnsatisfiableRowWithHead:body:usingInfeasibilityHandlingBehavior:mutuallyExclusiveConstraints:] + 489 17 Foundation 0x000000010909ded5 -[NSISEngine fixUpValueRestrictionViolationsWithInfeasibilityHandlingBehavior:] + 613 18 Foundation 0x000000010923eab7 -[NSISEngine _optimizeWithoutRebuilding] + 134 19 Foundation 0x000000010909dc0f -[NSISEngine optimize] + 46 20 Foundation 0x00000001090a4875 -[NSISEngine constraintDidChangeSuchThatMarker:shouldBeReplacedByMarkerPlusDelta:] + 313 21 Foundation 0x00000001090a46f2 -[NSISEngine tryToChangeConstraintSuchThatMarker:isReplacedByMarkerPlusDelta:undoHandler:] + 440 22 Foundation 0x0000000109090715 -[NSLayoutConstraint _tryToChangeContainerGeometryWithUndoHandler:] + 484 23 Foundation 0x0000000109090274 -[NSLayoutConstraint _setSymbolicConstant:constant:] + 422 24 UIKit 0x000000010a83edcc -[UIView _updateLayoutMarginsGuideConstraintsIfApplicable] + 529 25 UIKit 0x000000010a83ef5d -[UIView _layoutMarginsDidChange] + 100 26 UIKit 0x000000010a83f735 -[UIView _updateInferredLayoutMargins] + 1740 27 UIKit 0x000000010a84f4ce -[UIView(Geometry) setBounds:] + 2380 28 UIKit 0x000000010a84e6b2 -[UIView(Geometry) _applyISEngineLayoutValues] + 477 29 UIKit 0x000000010a84e9e2 -[UIView(Geometry) _resizeWithOldSuperviewSize:] + 127 30 CoreFoundation 0x000000010c5d4d32 __53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke + 114 31 CoreFoundation 0x000000010c5d44af -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 335 32 UIKit 0x000000010a84d2f3 -[UIView(Geometry) resizeSubviewsWithOldSize:] + 184 33 UIKit 0x000000010b09b2bb -[UIView(AdditionalLayoutSupport) _is_layout] + 167 34 UIKit 0x000000010a853cfa -[UIView(Hierarchy) _updateConstraintsAsNecessaryAndApplyLayoutFromEngine] + 771 35 UIKit 0x000000010a863980 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 703 36 QuartzCore 0x000000010a31cc00 -[CALayer layoutSublayers] + 146 37 QuartzCore 0x000000010a31108e _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366 38 QuartzCore 0x000000010a310f0c _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24 39 QuartzCore 0x000000010a3053c9 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 277 40 QuartzCore 0x000000010a333086 _ZN2CA11Transaction6commitEv + 486 41 UIKit 0x000000010a7d519b _afterCACommitHandler + 174 42 CoreFoundation 0x000000010c5d1c37 CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 23 43 CoreFoundation 0x000000010c5d1ba7 __CFRunLoopDoObservers + 391 44 CoreFoundation 0x000000010c5c77fb __CFRunLoopRun + 1147 45 CoreFoundation 0x000000010c5c70f8 CFRunLoopRunSpecific + 488 46 GraphicsServices 0x000000010e70aad2 GSEventRunModal + 161 47 UIKit 0x000000010a7a8f09 UIApplicationMain + 171 48 Sportle 0x0000000106ab6cdf main + 367 49 libdyld.dylib 0x000000010ddec92d start + 1 50 ??? 0x0000000000000001 0x0 + 1 )

    opened by plarson 1
  • FLKAutoLayout causes crash on iOS9 when using topLayoutGuide or bottomLayoutGuide

    FLKAutoLayout causes crash on iOS9 when using topLayoutGuide or bottomLayoutGuide

    topLayoutGuide and bottomLayoutGuide used to be subclasses of UIView, but they aren't in iOS9.

    I patched my fork with this: https://github.com/lisbakke/FLKAutoLayout/commit/84eec85d9dae08bae801bffbe051dcf8bd5e7558

    opened by lisbakke 1
  • Assert on predicates that would return nil

    Assert on predicates that would return nil

    FLKAutoLayout supported an interesting feature of Auto Layout that would let you create predicates that would not be applied due to too high of a priority, this breaks all the nullability checks in 1.0 alas, and so is removed via runtime asserts.

    Re #49

    opened by orta 1
  • It may cause crash when using `FLKNoConstraint`

    It may cause crash when using `FLKNoConstraint`

    Here is what I am using:

    button.alignTop("20", leading: FLKNoConstraint, bottom: FLKNoConstraint, trailing: "-27", toView: self.view)

    In previous version, it works perfectly, but in 1.0 version, it cause crash.

    opened by gonghao 4
  • Use Swift's protocol extensions to remove the `id` for the view / layout guide

    Use Swift's protocol extensions to remove the `id` for the view / layout guide

    Currently the API is:

    - (NSArray <NSLayoutConstraint *> *)alignToView:(id)view;
    

    This id isn't optimal. With Swift we could do something like:

    @objc protocol FLKViewable {
      var flkView: UIView { get }
    }
    
    extension UIView: FLKViewable {
      var flkView: UIView  {
        return self
      }
    }
    extension UILayoutGuide: FLKViewable {
      var flkView: UIView  {
        return self.representedView
      }
    }
    extension FLKLayoutGuide: FLKViewable {
      var flkView: UIView  {
        return self.flk_view
      }
    }
    

    Then we could constrain the view to be a FLKViewable:

    - (NSArray <NSLayoutConstraint *> *)alignToView:(NSObject <FLKViewable> *)view;
    
    enhancement 
    opened by orta 0
  • @Florian => Fix the example app, fixes #17 #39 #33

    @Florian => Fix the example app, fixes #17 #39 #33

    I'll save this one for a patch release, and get 1.0.0 out - so this isn't blocking.

    I'm interested in the ramifications here:

    -    CGFloat multiplier = 0;
    +    CGFloat multiplier = 0.01;
    

    It seems reasonable to think when FLKAutoLayout was written Auto Layout would accept a multiplier of 0 in constraints - but since then, maybe since iOS8? The API does not allow using a 0 as the multiplier - which causes crashes in the example app, and assumably in all of the app code ( I don't see any uses of distributeCenterXOfViews or the others in Eigen, I expect because of this. )

    Can you think of a better way to do this, and/or do you think this would cause issues?

    /cc @alloy if you want to have a think too

    opened by orta 3
Owner
Florian Kugler
Florian Kugler
A tiny category on UIView that allows you to set one property: "parallaxIntensity" to achieve a parallax effect with UIMotionEffect

NGAParallaxMotion A tiny category on UIView that allows you to set one property: parallaxIntensity to achieve a parallax effect with UIMotionEffect. S

Michael Bishop 650 Sep 26, 2022
Custom UIView class that hosts an array of UIbuttons that have an 'underline' UIView beneath them which moves from button to button when the user presses on them.

Swift-Underlined-Button-Bar Custom UIView class that hosts an array of UIbuttons that have an 'underline' UIView beneath them which moves from button

Justin Cook 3 Aug 4, 2022
Swift microframework for declaring Auto Layout constraints functionally

Relayout Relayout is a Swift microframework to make using Auto Layout easier with static and dynamic layouts. Why? If you want to build a UI using App

Steve Streza 560 Nov 19, 2022
In this repository I've learned how to use the layout as well as alignment and constraints.

Auto Layout Our Goal At the moment, our app only looks good on the canvas dimension that we’ve selected. If you run the app on screens with different

Pedro Couventaris Daspett 1 Apr 23, 2022
FlightLayout is a light weight, and easy to learn layout framework as an extension of the UIView.

FlightLayout Introduction FlightLayout is a light weight, and easy to learn layout framework as an extension of the UIView. Functionally, it lives som

Anton 23 Apr 21, 2022
Library that makes it easy to create multiple environments within a single app. You can switch environments without deleting the application.

AppContainer Library that makes it easy to create multiple environments within a single app. You can switch environments without deleting the applicat

null 8 Dec 15, 2022
Auto Layout made easy with the Custom Layout.

Auto Layout made easy with the Custom Layout. Getting started CocoaPods CocoaPods is a dependency manager for Cocoa projects. You can install it with

Malith Nadeeshan 1 Jan 16, 2022
Minimal AutoLayout convenience layer. Program constraints succinctly.

MiniLayout Minimal AutoLayout convenience layer. Program constraints succinctly. Usage Put label over textField // using MiniLayout: view.constrain(la

Yonat Sharon 8 Jul 7, 2021
iOS constraint maker you always wanted. Write constraints like sentences in English. Simple

YeahLayout iOS constraint maker you always wanted. Write constraints like sentences in English. Simple. Intuitive. No frightening abstractions. One fi

Андрей Соловьев 1 Jan 10, 2022
Build 1 scene, let AutoLayoutMagic generate the constraints for you!

Auto Layout Magic Create 1 scene, let Auto Layout Magic generate the constraints for you Hello friends, We've all been there. You have an app supporti

Matt 61 Sep 21, 2019
An easy way to create and layout UI components for iOS (Swift version).

Introduction Cupcake is a framework that allow you to easily create and layout UI components for iOS 8.0+. It use chaining syntax and provides some fr

nerdycat 288 Oct 9, 2022
(Swift) iOS UIView layout reimagined

<UIViewprint/> iOS view layout completely reimagined Blueprint /ˈbluːˌprɪnt/ : a detailed outline or plan of action: a blueprint for success. class Vi

Alex Winston 8 Aug 26, 2022
An flexbox layout aimed at easy to use, which depend on Yoga.

DDFlexbox A flexbox framework for easy using. Install pod 'DDFlexbox' Template install Recommend using templates to create flexbox views. cd Script/

Daniel 12 Mar 23, 2022
TinyConstraints is the syntactic sugar that makes Auto Layout sweeter for human use.

TinyConstraints is the syntactic sugar that makes Auto Layout sweeter for human use. Features Pure Swift 5 sweetness. Everything you can do with Auto

Robert-Hein Hooijmans 3.8k Jan 5, 2023
SuperLayout is a Swift library that makes using Auto Layout a breeze.

SuperLayout is a library that adds a few custom operators to Swift that makes using the amazing NSLayoutAnchor API for Auto Layout a breeze. SuperLayo

Lionheart Software 53 Oct 12, 2022
Written in pure Swift, QuickLayout offers a simple and easy way to manage Auto Layout in code.

QuickLayout QuickLayout offers an additional way, to easily manage the Auto Layout using only code. You can harness the power of QuickLayout to align

Daniel Huri 243 Oct 28, 2022
Auto Layout (and manual layout) in one line.

Auto Layout (and manual layout) in one line. Quick Look view.bb.centerX().below(view2).size(100) It’s equivalent to iOS 9 API: view.centerXAnchor.cons

Javier Zhang 74 Oct 19, 2022
AppStoreClone - Understanding the complex layout of app store using UICompositional layout in swift

AppStoreClone Understanding the complex layout of app store using UICompositiona

Dheeraj Kumar Sharma 8 Dec 28, 2022
A custom layout built on top of SwiftUI's Layout API that lays elements out in multiple lines. Similar to flex-wrap in CSS, CollectionViewFlowLayout.

WrapLayout A custom layout built on top of SwiftUI's Layout API that lays elements out in multiple lines. Similar to flex-wrap in CSS, CollectionViewF

Hiroshi Kimura 6 Sep 27, 2022