{"id":16742497,"url":"https://github.com/johnsundell/cgoperators","last_synced_at":"2025-03-17T01:32:06.787Z","repository":{"id":43673610,"uuid":"97259044","full_name":"JohnSundell/CGOperators","owner":"JohnSundell","description":"Easily manipulate CGPoints, CGSizes and CGVectors using math operators","archived":false,"fork":false,"pushed_at":"2017-11-05T22:51:43.000Z","size":27,"stargazers_count":149,"open_issues_count":0,"forks_count":10,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-11T20:28:50.005Z","etag":null,"topics":["coregraphics","operators","swift","xcode"],"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/JohnSundell.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-14T17:44:57.000Z","updated_at":"2025-02-04T11:09:18.000Z","dependencies_parsed_at":"2022-08-20T18:40:08.543Z","dependency_job_id":null,"html_url":"https://github.com/JohnSundell/CGOperators","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohnSundell%2FCGOperators","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohnSundell%2FCGOperators/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohnSundell%2FCGOperators/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohnSundell%2FCGOperators/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JohnSundell","download_url":"https://codeload.github.com/JohnSundell/CGOperators/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243836015,"owners_count":20355615,"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":["coregraphics","operators","swift","xcode"],"created_at":"2024-10-13T01:23:56.255Z","updated_at":"2025-03-17T01:32:06.479Z","avatar_url":"https://github.com/JohnSundell.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg src=\"Logo.png\" width=\"305\" max-width=\"90%\" alt=\"CGOperators\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://cocoapods.org/pods/CGOperators\"\u003e\n        \u003cimg src=\"https://img.shields.io/cocoapods/v/CGOperators.svg\" alt=\"CocoaPods\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/Carthage/Carthage\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/carthage-compatible-4BC51D.svg?style=flat\" alt=\"Carthage\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://swift.org/package-manager\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/spm-compatible-brightgreen.svg?style=flat\" alt=\"Swift Package Manager\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/JohnSundell/Marathon\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/marathon-compatible-brightgreen.svg?style=flat\" alt=\"Marathon\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://twitter.com/johnsundell\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/contact-@johnsundell-blue.svg?style=flat\" alt=\"Twitter: @johnsundell\" /\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\nWelcome to `CGOperators`, a small Swift framework that enables you to easily manipulate Core Graphics' vector types (`CGPoint`, `CGSize` and `CGVector`) using math operators. It can help you write compact, yet highly readable code when dealing with things like image sizes and frame-based layouts.\n\n## Examples\n\n**Add two vectors**\n\n```swift\nlet point = view.frame.origin + CGPoint(x: 10, y: 20)\nlet size = image.size + view.frame.size\nlet vector = physicsWorld.gravity + player.size\n```\n\n**Subtract two vectors**\n\n```swift\nlet point = view.frame.origin - CGPoint(x: 10, y: 20)\nlet size = image.size - view.frame.size\nlet vector = physicsWorld.gravity - player.size\n```\n\n**Multiply a vector with a constant**\n\n```swift\nview.frame.size = image.size * 4\nbutton.frame.origin = superview.bounds.size * 2\nphysicsWorld.gravity = player.position * 10\n```\n\n**Divide a vector by a constant**\n\n```swift\nview.frame.size = image.size / 4\nbutton.frame.origin = superview.bounds.size / 2\nphysicsWorld.gravity = player.position / 10\n```\n\n## Installation\n\n**Using [CocoaPods](https://cocoapods.org)**\n\nAdd `pod CGOperators` to your `Podfile`\n\n**Using [Carthage](https://github.com/Carthage/Carthage)**\n\nAdd `git \"JohnSundell/CGOperators\"` to your `Cartfile`\n\n**Using the [Swift Package Manager](https://github.com/apple/swift-package-manager)**\n\nAdd `Package(url: \"https://github.com/JohnSundell/CGOperators.git\", majorVersion: 1)` to your `Package.swift` file.\n\n**Using [Marathon](https://github.com/JohnSundell/Marathon)**\n\nRun `marathon add https://github.com/JohnSundell/CGOperators.git` on the command line.\n\n## Help, feedback or suggestions?\n\n- [Open an issue](https://github.com/JohnSundell/CGOperators/issues/new) if you need help, if you found a bug, or if you want to discuss a feature request.\n- [Open a PR](https://github.com/JohnSundell/CGOperators/pull/new/master) if you want to make some change to `CGOperators`.\n- Contact [@johnsundell on Twitter](https://twitter.com/johnsundell) for discussions, news \u0026 announcements about `CGOperators` and other open source projects.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnsundell%2Fcgoperators","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnsundell%2Fcgoperators","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnsundell%2Fcgoperators/lists"}