{"id":19773970,"url":"https://github.com/bibinjacobpulickal/bblayoutkit","last_synced_at":"2025-10-13T22:17:32.370Z","repository":{"id":63905348,"uuid":"268117335","full_name":"bibinjacobpulickal/BBLayoutKit","owner":"bibinjacobpulickal","description":"A simple and lightweight Auto-Layout Kit that makes you feels laying out views as a fun game. BBLayaoutKit supports UIKit on iOS \u0026 tvOS and AppKit on MacOS so you wouldn't have to worry about using different solutions on different platforms. BBLayoutKit is compiled on Xcode 11.4 using Swift 5.2 and will be updated for all future releases.","archived":false,"fork":false,"pushed_at":"2021-02-24T05:36:58.000Z","size":57,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-15T00:46:27.054Z","etag":null,"topics":["appkit","auto-layout","auto-layout-programmatically","cocoa","ios","macos","swift","swift-package-manager","uikit"],"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/bibinjacobpulickal.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":"2020-05-30T16:24:58.000Z","updated_at":"2021-06-23T11:47:24.000Z","dependencies_parsed_at":"2022-11-28T19:38:39.714Z","dependency_job_id":null,"html_url":"https://github.com/bibinjacobpulickal/BBLayoutKit","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/bibinjacobpulickal/BBLayoutKit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bibinjacobpulickal%2FBBLayoutKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bibinjacobpulickal%2FBBLayoutKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bibinjacobpulickal%2FBBLayoutKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bibinjacobpulickal%2FBBLayoutKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bibinjacobpulickal","download_url":"https://codeload.github.com/bibinjacobpulickal/BBLayoutKit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bibinjacobpulickal%2FBBLayoutKit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279017155,"owners_count":26085983,"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-10-13T02:00:06.723Z","response_time":61,"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":["appkit","auto-layout","auto-layout-programmatically","cocoa","ios","macos","swift","swift-package-manager","uikit"],"created_at":"2024-11-12T05:11:38.567Z","updated_at":"2025-10-13T22:17:32.335Z","avatar_url":"https://github.com/bibinjacobpulickal.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BBLayoutKit\n\nA simple and lightweight Auto-Layout Kit that makes you feels laying out views as a fun game. BBLayaoutKit supports UIKit on iOS \u0026 tvOS and AppKit on MacOS so you wouldn't have to worry about using different solutions on different platforms. BBLayoutKit is compiled on Xcode 12.0 using Swift 5.3 and will be updated for all future releases.\n\n[![Platform](http://img.shields.io/badge/platform-ios-blue.svg?style=flat)](https://developer.apple.com/iphone/index.action)\n[![Language](http://img.shields.io/badge/language-swift-brightgreen.svg?style=flat)](https://developer.apple.com/swift)\n![Swift version](https://img.shields.io/badge/swift-5.3-orange.svg)\n[![License](http://img.shields.io/badge/license-MIT-lightgray.svg?style=flat)](https://github.com/bibinjacobpulickal/BBLayoutKit/blob/master/LICENSE)\n\n## Why use BBLayoutKit?\n\nHave you ever had to write lines and lines of code to add subviews and anchor them like the following:\n```swift\nview.addSubview(subview)\nsubview.translatesAutoresizingMaskIntoConstraints = false\n\nsubview.topAnchor.constraint(equalTo: view.bottomAnchor).isActive = true\n...\nsubview.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true\n```\n\nWorry no more BBLayoutKit helps you with this situation as follows:\n```swift\nview.addSubview(subview) {\n    subview.top      == view.bottom\n    ...\n    subview.trailing == view.trailing\n}\n// Or in short 🙂\nview.addSubview(subview) { $0.sides == $1.sides }\n\n// Or even shorter 😎\nview.addSubview(subview) { $0 === $1 } \n```\n\nYou see thats all thats required. Now, you might be wondering what would you do if you had to make a constraint with a relation that's not equal but, less than or greater than, like the following:\n```swift\nsubview.leadingAnchor.constraint(lessThanOrEqualTo: view.leadingAnchor, constant: -8).isActive = true\nsubview.trailingAnchor.constraint(greaterThanOrEqualTo: view.trailingAnchor: constant: 16).isActive = true\n```\n\nBBLayoutKit let's you do this:\n```swift\nsubview.leading  \u003c= view.leading\nsubview.trailing \u003e= view.trailing\n```\n\nIn the case of constants you can add or substract them in the same expresion, so instead of this:\n```swift\nsubview.topAnchor.constraint(equalTo: view.bottomAnchor, constant: 16).isActive = true\nsubview.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: -32).isActive = true\n```\n\nYou only need this:\nsubview.top     == view.bottom + 16\nsubview.leading == view.trailing - 32\nIf you would like to get the constraint for animations or reference in future, just do:\n```swift\nlet subviewTopConstraint      = subview.top == view.bottom + 16\nsubviewTopConstraint.constant = 32\n```\n\nIf you don't want the constraints to not be active on the first go just do, '!=' or even '!\u003c=' and '!\u003e=', like the following:\n```swift\nsubview.top      != view.bottom\nsubview.leading  !\u003c= view.leading\nsubview.trailing !\u003e= view.trailing\n```\n\nIn case of dimensions like height or width:\n```swift\nsubview.widthAnchor.constraint(equalTo: view.widthAnchor, multiplier: 2, constant: 8).isActive = true\nsubview.heightAnchor.constraint(equalToConstant: 64).isActive = true\n```\nYou only need this:\n```swift\nsubview.width  == view.width * 2 + 8\nsubview.height == 64\n```\nFor addSubview and translatesAutoresizingMaskIntoConstraints = false you could just write a closure as follows:\n```swift\nview.addSubview(subview) {\n  subview.sides \u003c= view.sides\n}\n```\nYou also have other helpers like sides that include all sides, and size which takes a CGSize and also both horizontal and vertical constraints and centers.\n```swift\n// Constraint all sides with a padding of 2\nsubview.sides == view.sides + 2\n\n// Constraint all sides with different padding on each side.\nsubview.sides == view.sides + UIEdgeInsets(t: 1, l: 2, b: 4, r: 8)\n\n// Align both centers of view and subview\nsubview.centers == view.centers\n\n// Constraint both centers with offsets 4 and 8.\nsubview.centers == view.centers + UIOffset(x: 4, y: 8)\n\n// Constraint vertical(top and bottom) or horizontal(leading and trailing)\nsubview.vertical   == view.vertical\nsubview.horizontal == view.horizontal\n\n// Constraint size either with CGSize or both sides 64\nsubview.size == CGSize(w: 8, h: 16)\nsubview.size == 64\n```\n\n## Installation\n\n### Swift Package Manager\n\nThe [Swift Package Manager](https://swift.org/package-manager/) is a tool for automating the distribution of Swift code and is integrated into the `swift` compiler. It is in early development, but BBLoader does support its use on supported platforms.\n\nOnce you have your Swift package set up, adding BBLoader as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`.\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/bibinjacobpulickal/BBLayoutKit.git\", .upToNextMajor(from: \"1.0.0\"))\n]\n```\nFrom Xcode 11.0+ you only need to provide the above mentioned URL.\n\n## Features\n- [x] Remove repetitive code while creating new view.\n- [x] Fill super view or any other view with/without padding.\n- [x] Align center with super view or any other view.\n\n## Requirements\n\n- iOS 9.0+\n- Xcode 8.3+\n- Swift 3.0+\n\n## License\nBBLayoutKit is released under the MIT license.  \nSee [LICENSE](https://github.com/bibinjacobpulickal/BBLayoutKit/blob/master/LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbibinjacobpulickal%2Fbblayoutkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbibinjacobpulickal%2Fbblayoutkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbibinjacobpulickal%2Fbblayoutkit/lists"}