{"id":18616520,"url":"https://github.com/davidask/layoutaid","last_synced_at":"2025-07-26T10:15:26.000Z","repository":{"id":63907690,"uuid":"267969066","full_name":"davidask/LayoutAid","owner":"davidask","description":"Declarative AutoLayout DSL and utilities for iOS, tvOS, and macOS","archived":false,"fork":false,"pushed_at":"2020-12-27T19:43:14.000Z","size":37,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-20T04:56:30.191Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/davidask.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-29T22:43:33.000Z","updated_at":"2024-07-26T05:46:24.000Z","dependencies_parsed_at":"2022-11-28T22:51:53.458Z","dependency_job_id":null,"html_url":"https://github.com/davidask/LayoutAid","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/davidask/LayoutAid","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidask%2FLayoutAid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidask%2FLayoutAid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidask%2FLayoutAid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidask%2FLayoutAid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidask","download_url":"https://codeload.github.com/davidask/LayoutAid/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidask%2FLayoutAid/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267149781,"owners_count":24043461,"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","status":"online","status_checked_at":"2025-07-26T02:00:08.937Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-07T03:35:33.585Z","updated_at":"2025-07-26T10:15:25.981Z","avatar_url":"https://github.com/davidask.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Tests](https://github.com/davidask/LayoutAid/workflows/Tests/badge.svg)\n\n# LayoutAid\nAutoLayout extensions for iOS, macOS, and tvOS.\n\n## Features\n\n- [x] Declarative DSL for creating layout constraints\n- [x] `keyboardLayoutGuide` for `UIView` on iOS, fully animatable\n- [x] `keyboardSafeAreaLayoutGuide` for `UIView` on iOS, fully animatable\n- [x] Extensions for `UIScrollView` adjusting `contentInset` based on keyboard appearance\n\n## Requirements\n\n- iOS 11+\n- tvOS 11+\n- macOS 10.11+\n\n## Installation\n\n### Carthage\nCreate a `Cartfile` that lists the framework and run `carthage update`. Follow the [instructions](https://github.com/Carthage/Carthage#if-youre-building-for-ios) to add `$(SRCROOT)/Carthage/Build/iOS/LayoutAid.framework` to an iOS project.\n\n```\ngithub \"davidask/LayoutAid\"\n```\n\n### Swift Package Manager\nThis project has support for Swift Package Manager.\n\n## Usage\n\nTo use the extensions provided in this library, you must `import LayoutAid`.\n\n### Layout DSL\n\n```swift\nNSLayoutConstraint.activate {\n    containerView.anchor(\n        Edges(equalTo: view.layoutMarginsGuide)\n    )\n\n    iconView.anchor {\n        Width(equalTo: 50)\n        AspectRatio(equalTo: 1)\n        Center(equalTo: containerView)\n    }\n\n    label.anchor {\n        Top(equalToSystemSpacingBelow: iconView)\n        CenterX(equalTo: containerView.readableContentGuide)\n        Width(lessThanOrEqualTo: containerView.readableContentGuide, multiplier: 0.5)\n    }\n}\n```\n\nConstraints are best activated in bulk, however, creating complex layouts can get verbose, even with layout anchors. This library provides two static methods on `NSLayoutConstraint` using function builders:\n\n- `build`, for creating constraints using a function builder\n- `activate`, for creating and activating constraints using a function builder\n\nTo constrain a view or layout guide use `view.anchor` or `layoutGuide.anchor`. Constrain blocks can be used inside `NSLayoutConstraint.build` or `NSLayoutConstraint.activate`.\n\nThis library aligns its semantics with Apples layout anchor API, meaning that you'll find a constraint builder for each anchor type, including convenience builders.\n\n* `Leading`\n* `Trailing`\n* `Left`\n* `Right`\n* `Top`\n* `Bottom`\n* `CenterX`\n* `CenterY`\n* `Center`\n* `Edges`\n* `DirectionalEdges`\n* `Size`\n* `AspectRatio`\n\n### Keyboard layout guides\n\nKeyboard management in iOS can be tricky. This library provides a lazy accessor to `keyboardLayoutGuide` and `keyboardSafeAreaLayoutGuide`. Backed by a `Keyboard` type observing the keyboard state this allows you to easily layout your views with the keyboard in mind.\n\n```swift\nNSLayoutConstraint.activate {\n    keyboardBackgroundView.anchor(\n        Edges(equalTo: view.keyboardLayoutGuide)\n    )\n\n    keyboardAvoidingView.anchor {\n        Leading(equalTo: view)\n        Trailing(equalTo: view)\n        Top(equalTo: view.safeAreaLayoutGuide)\n        Bottom(lessThanOrEqualTo: view.keyboardSafeAreaLayoutGuide)\n    }\n}\n```\n\n### UIScrollView extensions\n\nThis library can automatically adjust `contentInset` of `UIScrollView` based on keyboard appearance using\n- `UIScrollView.adjustContentInsetForKeyboard()`, to immediately adjust scroll view insets to keyboard\n- `UIScrollView.beginAdjustingContentInsetForKeyboard()`, to start observing keyboard adjusting scroll view insets automatically\n- `UIScrollView.endAdjustingContentInsetForKeyboard()`, to stop observing keyboard adjusting scroll view insets automatically\n\n## Contribute\nPlease feel welcome contributing to **LayoutAid**, check the ``LICENSE`` file for more info.\n\n## Credits\n\nDavid Ask","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidask%2Flayoutaid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidask%2Flayoutaid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidask%2Flayoutaid/lists"}