Swiftpack.co -  ww-tech/wwlayout as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
ww-tech/wwlayout
Swifty DSL for programmatic Auto Layout in iOS
.package(url: "https://github.com/ww-tech/wwlayout.git", from: "0.8.2")

WWLayout

WWLayout

Easy to write auto layout constraints, with minimal extensions to standard namespaces.

Feature Highlights

  • Easy to use, readable API
  • Backwards-compatible (i.e. pre iOS 11) Safe Area constraints
  • Tag constraints to easily switch between different layouts (coming soon)
  • Automatic switching of size-class based constraints (coming soon)

Introduction

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)

Dcumentation

Documentation can be found here

Installation

Swift Package Manager

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.

Cocoapods

Simply add WWLayout to your Podfile:

  pod 'WWLayout'

Contributing

Authors

License

WWLayout is © copyright by WW International.

WWLayout is licensed under the Apache-2.0 Open Source license.

GitHub

link
Stars: 40
Last commit: 2 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Release Notes

Version 0.8.0
31 weeks ago
  • Add versions of 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