{"id":15038946,"url":"https://github.com/meniny/justlayout","last_synced_at":"2025-04-10T00:02:41.796Z","repository":{"id":56917025,"uuid":"116344195","full_name":"Meniny/JustLayout","owner":"Meniny","description":"🤥 Sugar for Auto Layout. Generate pure native NSLayoutConstraint.","archived":false,"fork":false,"pushed_at":"2019-04-16T04:19:52.000Z","size":967,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-02T15:51:37.617Z","etag":null,"topics":["autolayout","ios","layout","swift","swift-4","visual-layout"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Meniny.png","metadata":{"files":{"readme":"README.adoc","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-05T05:03:44.000Z","updated_at":"2019-04-16T04:19:21.000Z","dependencies_parsed_at":"2022-08-20T21:20:31.024Z","dependency_job_id":null,"html_url":"https://github.com/Meniny/JustLayout","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Meniny%2FJustLayout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Meniny%2FJustLayout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Meniny%2FJustLayout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Meniny%2FJustLayout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Meniny","download_url":"https://codeload.github.com/Meniny/JustLayout/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239084401,"owners_count":19578773,"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":["autolayout","ios","layout","swift","swift-4","visual-layout"],"created_at":"2024-09-24T20:40:53.859Z","updated_at":"2025-02-16T03:31:37.588Z","avatar_url":"https://github.com/Meniny.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":":name: JustLayout\n:author: Elias Abel\n:author_esc: Elias%20Abel\n:mail: admin@meniny.cn\n:desc: an elegant Auto Layout sugar for iOS and tvOS\n:icon: {name}.png\n:version: 1.6.1\n:na: N/A\n:ios: 8.0\n:macos: {na}\n:watchos: {na}\n:tvos: 10.2\n:linux: {na}\n:xcode: 10.2\n:swift: 5\n:license: MIT\n:sep: %20%7C%20\n:platform: iOS{sep}tvOS\n:toclevels: 6\n:toc-title: TOC\n:source-highlighter: highlightjs\n:icons: font\n= Meet `{name}`\n{author} \u003c{mail}\u003e\nv{version}, 2018-05-23\n\n[subs=\"attributes\"]\n++++\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./Assets/{icon}\" alt=\"{name}\" height=\"200px\"\u003e\n  \u003cbr/\u003e\u003cbr/\u003e\n  \u003cimg alt=\"Author\" src=\"https://img.shields.io/badge/author-{author_esc}-blue.svg\"\u003e\n  \u003cimg alt=\"EMail\" src=\"https://img.shields.io/badge/mail-{mail}-orange.svg\"\u003e\n  \u003cimg alt=\"MIT\" src=\"https://img.shields.io/badge/license-{license}-blue.svg\"\u003e\n  \u003cbr/\u003e\n  \u003cimg alt=\"Version\" src=\"https://img.shields.io/badge/version-{version}-brightgreen.svg\"\u003e\n  \u003cimg alt=\"Platforms\" src=\"https://img.shields.io/badge/platform-{platform}-lightgrey.svg\"\u003e\n  \u003cimg alt=\"Swift\" src=\"https://img.shields.io/badge/swift-{swift}%2B-orange.svg\"\u003e\n  \u003cbr/\u003e\n  \u003cimg alt=\"Build Passing\" src=\"https://img.shields.io/badge/build-passing-brightgreen.svg\"\u003e\n  \u003cimg alt=\"Cocoapods\" src=\"https://img.shields.io/badge/cocoapods-compatible-brightgreen.svg\"\u003e\n  \u003cimg alt=\"Carthage\" src=\"https://img.shields.io/badge/carthage-compatible-brightgreen.svg\"\u003e\n  \u003cimg alt=\"SPM\" src=\"https://img.shields.io/badge/spm-compatible-brightgreen.svg\"\u003e\n\u003c/p\u003e\n++++\n\n:toc:\n\n== 🏵 Introduction\n\n**{name}** is {desc}.\n\n== 📋 Requirements\n\n[%header]\n|===\n2+^m|Type 1+^m|Requirement\n\n1.5+^.^|Platform ^|iOS ^|{ios}+\n^|macOS ^|{macos}\n^|tvOS ^|{tvos}\n^|watchOS ^|{watchos}\n^|Linux ^|{linux}\n\n^|IDE ^|Xcode ^| {xcode}+\n^|Language ^|Swift ^| {swift}+\n|===\n\n== 📲 Installation\n\n=== CocoaPods\n\n`{name}` is available on link:https://cocoapods.org[CocoaPods].\n\n[source, ruby, subs=\"verbatim,attributes\"]\n----\nuse_frameworks!\npod '{name}'\n\n# for DSL usage:\n#pod '{name}/DSL\n----\n\n=== Manually\n\nCopy all files in the `{name}` directory into your project.\n\n== 🛌 Dependency\n\n{na}\n\n== ❤️ Contribution\n\nYou are welcome to fork and submit pull requests.\n\n== 🔖 License\n\n`{name}` is open-sourced software, licensed under the link:./LICENSE.md[`{license}`] license.\n\n== 🔫 Usage\n\n[source, swift, subs=\"verbatim,attributes\"]\n----\nimport {name}\n----\n\n=== Visually\n\n[source, swift, subs=\"verbatim,attributes\"]\n----\nfunc visually() {\n    view.layout(\n        100,\n        |-topView-| ~ 80,\n        8,\n        |-centerView-(\u003e=100)-| ~ 80,\n        \"\",\n        |bottomView| ~ 80,\n        0\n    )\n}\n----\n\n=== Chainable\n\n[source, swift, subs=\"verbatim,attributes\"]\n----\nfunc chainable() {\n    centerView.centerInContainer().width(100).aspectratio(followHeight: 100%)\n    topView.left(centerView, -20).top(centerView, -20).size(centerView)\n    bottomView.left(centerView, 20).top(centerView, 20).size(centerView)\n}\n----\n\nimage::./Assets/AppIcon_480.png[AppIcon_480.png, 200]\n\n=== Operator-Based\n\n```swift\nfunc operatorBased() {\n    bottomView.centerXAttribute == view.centerXAttribute\n    bottomView.centerYAttribute == view.centerYAttribute\n    bottomView.widthAttribute == 80\n    bottomView.heightAttribute == bottomView.widthAttribute\n\n    centerView.rightAttribute == bottomView.centerXAttribute\n    centerView.topAttribute == bottomView.centerYAttribute\n    centerView.widthAttribute == bottomView.widthAttribute\n    centerView.heightAttribute == bottomView.heightAttribute\n\n    topView.leftAttribute == centerView.rightAttribute\n    topView.topAttribute == centerView.topAttribute\n    topView.widthAttribute == 50 % centerView.widthAttribute\n    topView.heightAttribute == centerView.heightAttribute\n}\n```\n\n[quote]\n____\nThe `Operator-Based` layout is now chainable after version `1.4.0`. For example:\n\n[source, swift]\n----\nsomeView.following(leftView).below(topView).size(centerView)\n----\n\n[source, swift]\n----\nsomeView.leftAttribute == leftView.rightAttribute\nsomeView.topAttribute == topView.bottomAttribute\nsomeView.widthAttribute == centerView.widthAttribute\nsomeView.heightAttribute == centerView.heightAttribute\n----\n____\n\n=== DSL\n\nAfter version `1.5.0` you can now use the `JustLayoutDSL`:\n\n[source, swift]\n----\ncenterView.just.centerInContainer().width(100).aspectratio(100%)\ntopView.just.left(centerView, -20).top(centerView, -20).size(centerView)\nbottomView.just.left(centerView, 20).top(centerView, 20).size(centerView)\n----\n\n[IMPORTANT]\n====\nPlease add `pod 'JustLayout/DSL' to your `Podfile` first.\n====\n\n---\n\nMade with icon:heart[2x] by {author}.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeniny%2Fjustlayout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmeniny%2Fjustlayout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeniny%2Fjustlayout/lists"}