{"id":1308,"url":"https://github.com/lionheart/SuperLayout","last_synced_at":"2025-08-02T04:30:52.553Z","repository":{"id":16372865,"uuid":"79827665","full_name":"lionheart/SuperLayout","owner":"lionheart","description":"SuperLayout is a Swift library that makes using Auto Layout a breeze.","archived":false,"fork":false,"pushed_at":"2022-07-22T01:24:00.000Z","size":819,"stargazers_count":52,"open_issues_count":4,"forks_count":8,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-19T18:45:49.725Z","etag":null,"topics":["apache2","auto-layout","ios","swift","swift-library","swift4"],"latest_commit_sha":null,"homepage":"https://code.lionheart.software/SuperLayout/","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lionheart.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-23T17:13:27.000Z","updated_at":"2023-10-05T20:21:53.000Z","dependencies_parsed_at":"2022-08-07T08:15:21.403Z","dependency_job_id":null,"html_url":"https://github.com/lionheart/SuperLayout","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lionheart%2FSuperLayout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lionheart%2FSuperLayout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lionheart%2FSuperLayout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lionheart%2FSuperLayout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lionheart","download_url":"https://codeload.github.com/lionheart/SuperLayout/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228438779,"owners_count":17920013,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apache2","auto-layout","ios","swift","swift-library","swift4"],"created_at":"2024-01-05T20:15:43.459Z","updated_at":"2024-12-06T08:30:45.468Z","avatar_url":"https://github.com/lionheart.png","language":"Swift","funding_links":[],"categories":["Layout"],"sub_categories":["Other Hardware","Other free courses"],"readme":"![](meta/repo-banner.png)\n[![](meta/repo-banner-bottom.png)][lionheart-url]\n\n[![CI Status](http://img.shields.io/travis/lionheart/SuperLayout.svg?style=flat)](https://travis-ci.org/lionheart/SuperLayout)\n[![Version](https://img.shields.io/cocoapods/v/SuperLayout.svg?style=flat)](http://cocoapods.org/pods/SuperLayout)\n[![License](https://img.shields.io/cocoapods/l/SuperLayout.svg?style=flat)](http://cocoapods.org/pods/SuperLayout)\n[![Platform](https://img.shields.io/cocoapods/p/SuperLayout.svg?style=flat)](http://cocoapods.org/pods/SuperLayout)\n\nSuperLayout is a library that adds a few custom operators to Swift that makes using the amazing NSLayoutAnchor API for Auto Layout a breeze. SuperLayout doesn't override already-defined methods in `Equatable` (such as `==` and `\u003e=`), and defines ones that are logical and easily understandable to anyone who might be inheriting your codebase or joining your team.\n\n## What It Does\n\nIn short, SuperLayout turns this:\n\n\u003cimg src='https://github.com/lionheart/SuperLayout/raw/master/old1.png' width='589px' /\u003e\n\nInto this:\n\n\u003cimg src='https://github.com/lionheart/SuperLayout/raw/master/new1.png' width='355px' /\u003e\n\n## How it works\n\nSuperLayout defines three custom operators: `~~`, `≥≥`, and `≤≤` that correspond to `equalTo`, `≥` to `greaterThanOrEqualTo`, and `≤` to `lessThanOrEqualTo`, respectively.\n\nThe greater than and less than operators were chosen with practicality in mind; `≥` and `≤` have simple keyboard shortcuts (just `Option` + `\u003c` and `Option` + `\u003e` in macOS), so there's no need to copy-paste characters when writing constraints.\n\n## Installation\n\nSuperLayout is available via CocoaPods and SwiftPM. If you're using CocoaPods, just specify this in your Podfile:\n\n    pod 'SuperLayout'\n\n### Before You Use\n\nTo use this library, you should have a basic understanding of the [`NSLayoutAnchor` API](https://developer.apple.com/reference/uikit/nslayoutanchor). If not, read up, and then check out the documentation below to get started.\n\n---\n\n## NSLayoutConstraint Reference\n\n\u003e Note: SuperLayout does not (yet) automatically turn off `translatesAutoresizingMaskIntoConstraints` for the views you'd like to manage with Auto Layout. Disabling this setting automatically is too magical for me. Feel free to create an issue if you disagree.\n\n[constraint(equalTo:)](https://developer.apple.com/reference/uikit/nslayoutanchor/1500946-constraint) ➥ `viewA.rightAnchor ~~ viewB.leftAnchor`\n\n\u003cdetails\u003e\n  \u003csummary\u003eOriginal\u003c/summary\u003e\n\n  ```swift\n  viewA.rightAnchor.constraint(equalTo: viewB.leftAnchor).isActive = true\n  ```\n\n\u003c/details\u003e\n\n[constraint(equalTo:constant:)](https://developer.apple.com/reference/uikit/nslayoutanchor/1500937-constraint) ➥ `viewA.rightAnchor ~~ viewB.leftAnchor + C`\n\n\u003cdetails\u003e\n  \u003csummary\u003eOriginal\u003c/summary\u003e\n\n  ```swift\n  viewA.rightAnchor.constraint(equalTo: viewB.leftAnchor, constant: C).isActive = true\n  ```\n\n\u003c/details\u003e\n\n[constraint(greaterThanOrEqualTo:)](https://developer.apple.com/reference/uikit/nslayoutanchor/1500936-constraint) ➥ `viewA.rightAnchor ≥≥ viewB.leftAnchor`\n\n\u003cdetails\u003e\n  \u003csummary\u003eOriginal\u003c/summary\u003e\n\n  ```swift\n  viewA.rightAnchor.constraint(greaterThanOrEqualTo: viewB.leftAnchor).isActive = true\n  ```\n\n\u003c/details\u003e\n\n[constraint(greaterThanOrEqualTo:constant:)](https://developer.apple.com/reference/uikit/nslayoutanchor/1500948-constraint) ➥ `viewA.rightAnchor ≥≥ viewB.leftAnchor + C`\n\n\u003cdetails\u003e\n  \u003csummary\u003eOriginal\u003c/summary\u003e\n\n  ```swift\n  viewA.rightAnchor.constraint(greaterThanOrEqualTo: viewB.leftAnchor, constant: C).isActive = true\n  ```\n\n\u003c/details\u003e\n\n[constraint(lessThanOrEqualTo:)](https://developer.apple.com/reference/uikit/nslayoutanchor/1500953-constraint) ➥ `viewA.rightAnchor ≤≤ viewB.leftAnchor`\n\n\u003cdetails\u003e\n  \u003csummary\u003eOriginal\u003c/summary\u003e\n\n  ```swift\n  viewA.rightAnchor.constraint(lessThanOrEqualTo: viewB.leftAnchor).isActive = true\n  ```\n\n\u003c/details\u003e\n\n[constraint(lessThanOrEqualTo:constant:)](https://developer.apple.com/reference/uikit/nslayoutanchor/1500959-constraint) ➥ `viewA.rightAnchor ≤≤ viewB.leftAnchor + C`\n\n\u003cdetails\u003e\n  \u003csummary\u003eOriginal\u003c/summary\u003e\n\n  ```swift\n  viewA.rightAnchor.constraint(lessThanOrEqualTo: viewB.leftAnchor, constant: C).isActive = true\n  ```\n\n\u003c/details\u003e\n\n---\n\n## NSLayoutDimension Reference\n\n[constraint(equalTo:multiplier:)](https://developer.apple.com/reference/uikit/nslayoutdimension/1500951-constraint) ➥ `viewA.heightAnchor ~~ viewB.heightAnchor * M`\n\n\u003cdetails\u003e\n  \u003csummary\u003eOriginal\u003c/summary\u003e\n\n  ```swift\n  viewA.heightAnchor.constraint(equalTo: viewB.heightAnchor, multiplier: M).isActive = true\n  ```\n\n\u003c/details\u003e\n\n[constraint(equalTo:multiplier:constant:)](https://developer.apple.com/reference/uikit/nslayoutdimension/1500934-constraint) ➥ `viewA.heightAnchor ~~ viewB.heightAnchor * M + C`\n\n\u003cdetails\u003e\n  \u003csummary\u003eOriginal\u003c/summary\u003e\n\n  ```swift\n  viewA.heightAnchor.constraint(equalTo: viewB.heightAnchor, multiplier: M, constant: C).isActive = true\n  ```\n\n\u003c/details\u003e\n\n[constraint(equalToConstant:)](https://developer.apple.com/reference/uikit/nslayoutdimension/1500941-constraint) ➥ `viewA.heightAnchor ~~ C`\n\n\u003cdetails\u003e\n  \u003csummary\u003eOriginal\u003c/summary\u003e\n\n  ```swift\n  viewA.heightAnchor.constraint(equalToConstant: C).isActive = true\n  ```\n\n\u003c/details\u003e\n\n[constraint(greaterThanOrEqualTo:multiplier:)](https://developer.apple.com/reference/uikit/nslayoutdimension/1500961-constraint) ➥ `viewA.heightAnchor ≥≥ viewB.heightAnchor * M`\n\n\u003cdetails\u003e\n  \u003csummary\u003eOriginal\u003c/summary\u003e\n\n  ```swift\n  viewA.heightAnchor.constraint(greaterThanOrEqualTo: viewB.heightAnchor, multiplier: M).isActive = true\n  ```\n\n\u003c/details\u003e\n\n[constraint(greaterThanOrEqualTo:multiplier:constant:)](https://developer.apple.com/reference/uikit/nslayoutdimension/1500965-constraint) ➥ `viewA.heightAnchor ≥≥ viewB.heightAnchor * M + C`\n\n\u003cdetails\u003e\n  \u003csummary\u003eOriginal\u003c/summary\u003e\n\n  ```swift\n  viewA.heightAnchor.constraint(greaterThanOrEqualTo: viewB.heightAnchor, multiplier: M, constant: C).isActive = true\n  ```\n\n\u003c/details\u003e\n\n[constraint(greaterThanOrEqualToConstant:)](https://developer.apple.com/reference/uikit/nslayoutdimension/1500939-constraint) ➥ `viewA.heightAnchor ≥≥ C`\n\n\u003cdetails\u003e\n  \u003csummary\u003eOriginal\u003c/summary\u003e\n\n  ```swift\n  viewA.heightAnchor.constraint(greaterThanOrEqualToConstant: C).isActive = true\n  ```\n\n\u003c/details\u003e\n\n[constraint(lessThanOrEqualTo:multiplier:)](https://developer.apple.com/reference/uikit/nslayoutdimension/1500943-constraint) ➥ `viewA.heightAnchor ≤≤ viewB.heightAnchor * M`\n\n\u003cdetails\u003e\n  \u003csummary\u003eOriginal\u003c/summary\u003e\n\n  ```swift\n  viewA.heightAnchor.constraint(lessThanOrEqualTo: viewB.heightAnchor, multiplier: M).isActive = true\n  ```\n\n\u003c/details\u003e\n\n[constraint(lessThanOrEqualTo:multiplier:constant:)](https://developer.apple.com/reference/uikit/nslayoutdimension/1500957-constraint) ➥ `viewA.heightAnchor ≤≤ viewB.heightAnchor * M + C`\n\n\u003cdetails\u003e\n  \u003csummary\u003eOriginal\u003c/summary\u003e\n\n  ```swift\n  viewA.heightAnchor.constraint(lessThanOrEqualTo: viewB.heightAnchor, multiplier: M, constant: C).isActive = true\n  ```\n\n\u003c/details\u003e\n\n[constraint(lessThanOrEqualToConstant:)](https://developer.apple.com/reference/uikit/nslayoutdimension/1500963-constraint) ➥ `viewA.heightAnchor ≤≤ C`\n\n\u003cdetails\u003e\n  \u003csummary\u003eOriginal\u003c/summary\u003e\n\n  ```swift\n  viewA.heightAnchor.constraint(lessThanOrEqualToConstant: C).isActive = true\n  ```\n\n\u003c/details\u003e\n\n## License\n\nSuperLayout is available under the Apache 2.0 license. See [LICENSE](LICENSE) for more info.\n\n[lionheart-url]: https://lionheartsw.com/\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flionheart%2FSuperLayout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flionheart%2FSuperLayout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flionheart%2FSuperLayout/lists"}