Latest 1.2.0
Homepage https://github.com/Meniny/JustLayout
License MIT
Platforms ios 8, tvos 10.2, requires ARC

JustLayout

VersionAuthorBuild PassingSwift
PlatformsMIT
CocoapodsCarthageSPM

Introduction

What’s this?

JustLayout is an elegant Auto Layout sugar for iOS.

Requirements

  • iOS 8.0+
  • tvOS 9.0+
  • Xcode 9 with Swift 4

Installation

CocoaPods

pod 'JustLayout'

Contribution

You are welcome to fork and submit pull requests.

License

JustLayout is open-sourced software, licensed under the MIT license.

Usage

import JustLayout

Visual

func visual() {
    view.layout(
        100,
        |-topView-| ~ 80,
        8,
        |-centerView-(>=100)-| ~ 80,
        "",
        |bottomView| ~ 80,
        0
    )
}

Chainable

func chainable() {
    bottomView.left(100).top(100).width(100).aspect(ofWidth: 100)
    centerView.left(120).top(120).width(100).aspect(ofWidth: 100)
    topView.left(140).top(140).width(100).aspect(ofWidth: 100%)
}

Operator-Based

func operatorBased() {
    bottomView.centerXAttribute == view.centerXAttribute
    bottomView.centerYAttribute == view.centerYAttribute
    bottomView.widthAttribute == 80
    bottomView.heightAttribute == bottomView.widthAttribute

    centerView.rightAttribute == bottomView.centerXAttribute
    centerView.topAttribute == bottomView.centerYAttribute
    centerView.widthAttribute == bottomView.widthAttribute
    centerView.heightAttribute == bottomView.heightAttribute

    topView.leftAttribute == centerView.rightAttribute
    topView.topAttribute == centerView.topAttribute
    topView.widthAttribute == 50 % centerView.widthAttribute
    topView.heightAttribute == centerView.heightAttribute
}

Latest podspec

{
    "name": "JustLayout",
    "version": "1.2.0",
    "summary": "An elegant Auto Layout sugar for iOS",
    "homepage": "https://github.com/Meniny/JustLayout",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": "Elias Abel",
    "source": {
        "git": "https://github.com/Meniny/JustLayout.git",
        "tag": "1.2.0"
    },
    "social_media_url": "https://meniny.cn/",
    "source_files": "JustLayout/**/*.swift",
    "requires_arc": true,
    "platforms": {
        "ios": "8",
        "tvos": "10.2"
    },
    "description": "JustLayout is an elegant Auto Layout sugar for iOS.",
    "module_name": "JustLayout",
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This