{"id":30719828,"url":"https://github.com/dankinsoid/vdpin","last_synced_at":"2025-09-03T10:42:20.333Z","repository":{"id":63559806,"uuid":"568696640","full_name":"dankinsoid/VDPin","owner":"dankinsoid","description":"Convenience pin methods for constraints creation","archived":false,"fork":false,"pushed_at":"2023-03-26T13:41:19.000Z","size":47,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-17T05:49:25.188Z","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/dankinsoid.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-11-21T08:09:25.000Z","updated_at":"2022-11-21T08:19:18.000Z","dependencies_parsed_at":"2022-11-21T09:47:12.631Z","dependency_job_id":null,"html_url":"https://github.com/dankinsoid/VDPin","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":"dankinsoid/iOSLibraryTemplate","purl":"pkg:github/dankinsoid/VDPin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dankinsoid%2FVDPin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dankinsoid%2FVDPin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dankinsoid%2FVDPin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dankinsoid%2FVDPin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dankinsoid","download_url":"https://codeload.github.com/dankinsoid/VDPin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dankinsoid%2FVDPin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273431361,"owners_count":25104491,"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-09-03T02:00:09.631Z","response_time":76,"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":"2025-09-03T10:42:19.548Z","updated_at":"2025-09-03T10:42:20.324Z","avatar_url":"https://github.com/dankinsoid.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# VDPin\n\n[![CI Status](https://img.shields.io/travis/dankinsoid/VDPin.svg?style=flat)](https://travis-ci.org/dankinsoid/VDPin)\n[![Version](https://img.shields.io/cocoapods/v/VDPin.svg?style=flat)](https://cocoapods.org/pods/VDPin)\n[![License](https://img.shields.io/cocoapods/l/VDPin.svg?style=flat)](https://cocoapods.org/pods/VDPin)\n[![Platform](https://img.shields.io/cocoapods/p/VDPin.svg?style=flat)](https://cocoapods.org/pods/VDPin)\n\n## Description\n\nThis repository provides some convenience methods for creating constraints.\n\n\n## Usage\n\n1. Pin attributes of the view to a specified item or its superview.\n```swift\nview.pin(.edges)\nview.pin(.leading)\nview.pin(.edges(.horizontal), 16)\nview.pin(edges(.top, .bottom), 10, to: safeAreaLayoutGuide)\nview.pin(edges: [.top: 10, .horizontal: 5], to: safeAreaLayoutGuide)\n// pin view after/before another view\nrightView.pin(to: .trailing, of: leftView, options: .offset(10))\nview.pin(.center, 10)\nview.pin([.size: 100, .centerY: 10, .top: 20, .edges(.horizontal): 10])\n```\n2. Pin any attributes between two views\n```swift\nview.pin(.top, to: .centerY, of: anotherView)\n```\n3. Set aspect ratio of the view.\n```swift\nview.pin(aspectRatio: 2 / 3)\n```\n4. All pin methods contain a `with options` parameter.\n```swift\nview.pin(.edges, 10, options: .priority(.required))\n```\noptions:\n- `.priority(300)`: set the priority of the constraint\n- `.offset(10)`: set the offset of the constraint\n- `.multiplier(2)`: set the multiplier of the constraint\n- `.relation(.greaterThanOrEqual)`, `.greaterThanOrEqual`, `.lessThanOrEqual`: set the relation of the constraint\n- `.inactive`, `.activated(false)`: set the active state of the constraint\n- `.update`: update the constraint if it already exists\n- `.translatesAutoresizingMask`: don't change `translatesAutoresizingMaskIntoConstraints` property\n- `.safeArea`: use `safeAreaLayoutGuide` instead of `superview` as default second item\n5. All these methods can be chained\n```swift\nview\n    .pin(.edges(.horizontal), 10)\n    .pin(to: .bottom, of: anotherView.pin(.height, 50), options: .offset(20))\n    .pin(.size, 100)\n```\n6. Use `PartialRangeThrough` and `PartialRangeFrom` for offset value\n```swift\nview.pin(.bottom, 10..., with: .safeArea)\nview.pin(to: .bottom, of: anotherView, options: .offset(...10))\n```\n7. All these methods return `Constraints` object, that can be used for updating constraints.\n\n \n## Installation\n1. [Swift Package Manager](https://github.com/apple/swift-package-manager)\n\nCreate a `Package.swift` file.\n```swift\n// swift-tools-version:5.7\nimport PackageDescription\n\nlet package = Package(\n  name: \"SomeProject\",\n  dependencies: [\n    .package(url: \"https://github.com/dankinsoid/VDPin.git\", from: \"1.7.0\")\n  ],\n  targets: [\n    .target(name: \"SomeProject\", dependencies: [\"VDPin\"])\n  ]\n)\n```\n```ruby\n$ swift build\n```\n2.  [CocoaPods](https://cocoapods.org)\n\nAdd the following line to your Podfile:\n```ruby\npod 'VDPin'\n```\nand run `pod update` from the podfile directory first.\n\n## Author\n\ndankinsoid, voidilov@gmail.com\n\n## License\n\nVDPin is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdankinsoid%2Fvdpin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdankinsoid%2Fvdpin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdankinsoid%2Fvdpin/lists"}