{"id":28157160,"url":"https://github.com/modo-studio/curt","last_synced_at":"2025-05-15T08:18:18.099Z","repository":{"id":16956372,"uuid":"80433102","full_name":"modo-studio/Curt","owner":"modo-studio","description":"Swift operators to make constraints setup faster to write and easier to read.","archived":false,"fork":false,"pushed_at":"2022-10-05T22:46:08.000Z","size":73,"stargazers_count":3,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-03-27T09:14:54.756Z","etag":null,"topics":["autolayout","constraints","operators","swift"],"latest_commit_sha":null,"homepage":"http://caramba.io","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/modo-studio.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":"2017-01-30T15:20:28.000Z","updated_at":"2024-03-27T09:14:54.757Z","dependencies_parsed_at":"2023-01-11T20:25:42.106Z","dependency_job_id":null,"html_url":"https://github.com/modo-studio/Curt","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modo-studio%2FCurt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modo-studio%2FCurt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modo-studio%2FCurt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modo-studio%2FCurt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/modo-studio","download_url":"https://codeload.github.com/modo-studio/Curt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254301577,"owners_count":22047907,"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","constraints","operators","swift"],"created_at":"2025-05-15T08:16:26.313Z","updated_at":"2025-05-15T08:18:18.071Z","avatar_url":"https://github.com/modo-studio.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Curt\n\n[![Build Status](https://travis-ci.org/carambalabs/Curt.svg?branch=master)](https://travis-ci.org/carambalabs/Curt)\n[![codecov](https://codecov.io/gh/carambalabs/Curt/branch/master/graph/badge.svg)](https://codecov.io/gh/carambalabs/Curt)\n\nCurt is a collection of Swift operators to make constraints setup faster to write and easier to read.\n\nUsing Curt, constraints like:\n```Swift\nviewA.topAnchor.constraint(equalTo: viewB.bottomAnchor, constant: 10).isActive = true\n```\nCan be defined like:\n```Swift\nviewA.topAnchor ~ viewB.bottomAnchor + 10\n```\n\n## Installation\n\nTo install Curt you have to add the `Curt.swift` file to your project.\n\nSince operator overloading can't be done in a separate module Curt can't be added to you project using solutions like `cocoapods` or `carthage`. (*We are investigating solutions for this*)\n\n## Operators\n\nThese are the Curt operators and some examples, check out the [tests](https://github.com/carambalabs/Curt/blob/master/Example/CurtTests/Tests.swift) to see all the cases and examples between Curt and Native API. All the operators return **activated** `NSLayoutConstraint`.\n\n\n### Operator `~`\n\nYou can use it to constrain any kind of NSLayoutAnchor.\n\n```Swift\nviewA.topAnchor ~ viewB.topAnchor\nviewA.widthAnchor ~ viewB.widthAnchor\nviewA.centerXAnchor ~ viewB.centerXAnchor\nviewA.heightAnchor ~ 120\n```\n\nThis operator can also be used to constrain all X and Y axis anchors at once\n```Swift\nviewA ~ viewB\n```\n\n### Operators `\u003c~` `\u003e~`\n\nThis operators are the same but working as `lessThanOrEqualTo` and `greaterThanOrEqualTo`.\n\n```Swift\nviewA.topAnchor \u003e~ viewB.topAnchor\nviewA.widthAnchor \u003c~ viewB.widthAnchor\nviewA.heightAnchor \u003e~ 120\n```\n\n### Operators `+` `-`\n\nThese operators are used to add the constant to any constraint.\n```Swift\nviewA.topAnchor ~ viewB.bottomAnchor + 20\nviewA.bottomAnchor ~ viewC.bottomAnchor - 20\n```\n\n### Operator `*`\nThis operator is used to add the multiplier factor to any constraint.\n```Swift\nviewA.widthAnchor ~ viewA.heightAnchor * 2.0 + 40\n```\n\n## About\n\n\u003cimg src=\"https://github.com/carambalabs/Foundation/blob/master/ASSETS/logo-salmon.png?raw=true\" width=\"200\" /\u003e\n\nThis project is funded and maintained by [Caramba](http://caramba.io). We 💛 open source software!\n\nCheck out our other [open source projects](https://github.com/carambalabs/), read our [blog](http://blog.caramba.io) or say :wave: on twitter [@carambalabs](http://twitter.com/carambalabs).\n\n## Contribute\n\nContributions are welcome :metal: We encourage developers like you to help us improve the projects we've shared with the community. Please see the [Contributing Guide](https://github.com/carambalabs/Foundation/blob/master/CONTRIBUTING.md) and the [Code of Conduct](https://github.com/carambalabs/Foundation/blob/master/CONDUCT.md).\n\n## License\n\nCurt 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%2Fmodo-studio%2Fcurt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmodo-studio%2Fcurt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmodo-studio%2Fcurt/lists"}