{"id":18374266,"url":"https://github.com/mnkgitbox/customlayout","last_synced_at":"2025-04-11T02:44:19.141Z","repository":{"id":56906923,"uuid":"448358250","full_name":"MnkGitBox/CustomLayout","owner":"MnkGitBox","description":"Auto Layout made easy with the Custom Layout. ","archived":false,"fork":false,"pushed_at":"2022-02-12T05:38:01.000Z","size":621,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-17T18:04:31.180Z","etag":null,"topics":["autolayout","autolayout-constraints","autolayout-extension","autolayout-framework","customlayout","programatically","swift"],"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/MnkGitBox.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":"2022-01-15T18:24:47.000Z","updated_at":"2022-01-16T17:43:44.000Z","dependencies_parsed_at":"2022-08-20T19:50:20.118Z","dependency_job_id":null,"html_url":"https://github.com/MnkGitBox/CustomLayout","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MnkGitBox%2FCustomLayout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MnkGitBox%2FCustomLayout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MnkGitBox%2FCustomLayout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MnkGitBox%2FCustomLayout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MnkGitBox","download_url":"https://codeload.github.com/MnkGitBox/CustomLayout/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248331636,"owners_count":21085942,"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","autolayout-constraints","autolayout-extension","autolayout-framework","customlayout","programatically","swift"],"created_at":"2024-11-06T00:14:03.492Z","updated_at":"2025-04-11T02:44:19.112Z","avatar_url":"https://github.com/MnkGitBox.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"![banner](customLayout_banner.png)\n\n[![Version](https://img.shields.io/cocoapods/v/CustomLayout.svg?style=flat)](https://cocoapods.org/pods/CustomLayout)\n[![License](https://img.shields.io/cocoapods/l/CustomLayout.svg?style=flat)](https://cocoapods.org/pods/CustomLayout)\n[![Platform](https://img.shields.io/cocoapods/p/CustomLayout.svg?style=flat)](https://cocoapods.org/pods/CustomLayout)\n![SPM](https://img.shields.io/badge/Swift%20Package%20Manager-compatible-orange)\n\nAuto Layout made easy with the Custom Layout.\n\u003cbr\u003e\n\n## Installation\n\n#### CocoaPods\n[CocoaPods](https://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command:\n\n```ruby\n$ gem install cocoapods\n```\nTo integrate CustomLayout into your Xcode project using CocoaPods, specify it in your Podfile:\n\n```ruby\nsource 'https://github.com/CocoaPods/Specs.git'\nplatform :ios, '12.0'\nuse_frameworks!\n\ntarget '\u003cYour Target Name\u003e' do\n    pod 'CustomLayout', '~\u003e 1.0.1'\nend\n```\nThen, run the following command:\n```ruby\n$ pod install\n```\n\n#### Swift Package Manager\n\n[Swift Package Manager](https://swift.org/package-manager/) is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.\n\n\u003e Xcode 11+ is required to build CustomLayout using Swift Package Manager.\n\n```Swift\ndependencies: [\n    .package(url: \"https://github.com/MnkGitBox/CustomLayout.git\", .upToNextMajor(from: \"1.0.1\"))\n]\n```\n\n#### Manually\n\nIf you prefer not to use either of the aforementioned dependency managers, you can integrate CustomLayout into your project manually.\n\n---\n\n### Usage\nYou can call `layout.activate` method provided by the **Custom Layout** library.\n\n -  Without Custom Layout\n```Swift \nview.addSubview(redView)\n\nview.translatesAutoresizingMaskIntoConstraints = false\nNSLayoutConstraint.activate([redView.leadingAnchor.constraint(equalTo: view.leadingAnchor,\n                                                                    constant: 50),\n                            redView.trailingAnchor.constraint(equalTo: view.trailingAnchor,\n                                                                    constant: -50),\n                            redView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor,\n                                                                    constant: 40),\n                            redView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor,\n                                                                    constant: -20)])\n```\n - With Custom Layout\n```Swift\nview.addSubview(redView)\n\nredView.layout.activate([.leading(constant: 50), .traling(constant: -50), .top(constant: 40, safeAreaAlign: true), .bottom(constant: -20, safeAreaAlign: true)])\n```\n\n#### Layout to sibling views\nCustom Layout not only helps to layout subviews to its super view. We can use it to layout view components with other views who share the same ancestors.\n```Swift\ngreenView.layout.activate(to: [view : [.bottom(constant: -2, safeAreaAlign: true), .traling(constant: -20)],\n                                    redView : [.leadingToTraling(constant: -10), .topToBottom(constant: 20)]])\n```\n\n### Resources\n\nYou can find the original sample code [here](SampleCode.swift).\n\n## Credits\n- Malith Nadeeshan ([malithnadeeshan](https://twitter.com/malithnadeeshan))\n\n## License\n\nCustomLayout is released under the MIT license. See LICENSE for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmnkgitbox%2Fcustomlayout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmnkgitbox%2Fcustomlayout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmnkgitbox%2Fcustomlayout/lists"}