{"id":20630457,"url":"https://github.com/mkj-is/pathbuilder","last_synced_at":"2025-04-15T18:19:56.427Z","repository":{"id":52175387,"uuid":"210872771","full_name":"mkj-is/PathBuilder","owner":"mkj-is","description":"SwiftUI result builder for Path","archived":false,"fork":false,"pushed_at":"2023-12-13T15:14:04.000Z","size":98,"stargazers_count":75,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-15T18:19:48.720Z","etag":null,"topics":["dsl","functionbuilder","path","pathbuilder","resultbuilder","swift5-4","swiftui"],"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/mkj-is.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-09-25T14:59:50.000Z","updated_at":"2025-01-18T18:42:26.000Z","dependencies_parsed_at":"2022-08-24T03:51:43.209Z","dependency_job_id":"0b1176b7-15ce-4b8d-b277-1c3f0db8af2d","html_url":"https://github.com/mkj-is/PathBuilder","commit_stats":{"total_commits":43,"total_committers":1,"mean_commits":43.0,"dds":0.0,"last_synced_commit":"a5580affc0bce16dd637ed90c3bea51c7a6a2590"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkj-is%2FPathBuilder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkj-is%2FPathBuilder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkj-is%2FPathBuilder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkj-is%2FPathBuilder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mkj-is","download_url":"https://codeload.github.com/mkj-is/PathBuilder/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249126037,"owners_count":21216713,"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":["dsl","functionbuilder","path","pathbuilder","resultbuilder","swift5-4","swiftui"],"created_at":"2024-11-16T14:07:55.059Z","updated_at":"2025-04-15T18:19:56.409Z","avatar_url":"https://github.com/mkj-is.png","language":"Swift","readme":"\u003cimg alt=\"PathBuilder logo\" align=\"right\" src=\"Documentation/PathBuilder.svg\"\u003e\n\n# PathBuilder\n\n_Path builder_ is a complete result builder for lifting `Path` into the declarative SwiftUI world. This `@resultBuilder` can be used for elegant and short definition of paths. Missing documentation gaps in SwiftUI are filled in using the old but good CGMutablePath knowledge.\n\n## Motivation\n\nI just wanted to learn to implement result builders. And during playing with animated paths in SwiftUI found a perfect place to experiment.\n\n## Usage\n\n### Examples\n\nWith _PathBuilder_ you can write this to draw a triangle:\n\n```swift\nPath {\n    Move(to: CGPoint(x: 50, y: 50))\n    Line(to: CGPoint(x: 100, y: 100))\n    Line(to: CGPoint(x: 0, y: 100))\n    Close()\n}\n```\n\nInstead of longer version:\n\n```swift\nPath { p in\n    p.move(to: CGPoint(x: 50, y: 50))\n    p.addLine(to: CGPoint(x: 100, y: 100))\n    p.addLine(to: CGPoint(x: 0, y: 100))\n    p.closeSubpath()\n}\n```\n\nDrawing a Swift logo can be implemented like [this](Documentation/SwiftLogo.swift).\n\n![Swift logo path drawing using PathBuilder](Documentation/SwiftLogo.png)\n\n### Path components\n\nThere are many basic path components present. You can create a new one by conforming to the `PathComponent` protocol.\n\n#### Elementary components\n\n- *Arc* – Adds an arc of a circle to the path, specified with a radius and angles.\n- *Close* – Closes and completes a subpath in a path.\n- *Curve* – Adds a cubic Bézier curve to the path, with the specified end point and control points.\n- *Oval* – Adds an ellipse that fits inside the specified rectangle.\n- *EmptySubpath* – Adds empty subpath, used mainly as a temporary placeholder.\n- *Line* – Appends a straight line segment from the current point to the specified point.\n- *Lines* – Adds a sequence of connected straight-line segments to the path.\n- *Move* – Begins a new subpath at the specified point.\n- *QuadCurve* – Adds a quadratic Bézier curve to the path, with the specified end point and control point.\n- *Rect* – Adds a set of rectangular subpaths to the path.\n- *RelativeArc* – Adds an arc of a circle to the path, specified with a radius and a difference in angle.\n- *RoundedRect* – Adds a subpath to the path, in the shape of a rectangle with rounded corners.\n- *TangentArc* – Adds an arc of a circle to the path, specified with a radius and two tangent lines.\n\n#### Grouping components\n\n- *Loop* – Appends components to path iterating over supplied sequence and building path for each element.\n- *Subpath* – Groups and appends another subpath object to the path and optionally transforms it.\n\n## Requirements\n\nFor Swift 5.1 to 5.3 use package version 1.1.1.\n\nOtherwise for version 2.0+ use latest tools:\n\n- Xcode 12.5 or above\n- Swift 5.4 or above\n- iOS 13, macOS 10.15, watchOS 6.0, tvOS 13.0 or above\n\n## Installation\n\nUsing Swift Package Manager in Xcode\nor by adding to your Package manifest file.\n\n## Contributing\n\nAll contributions are welcome.\n\nProject was created by [Matěj Kašpar Jirásek](https://github.com/mkj-is).\n\nProject is licensed under [MIT license](LICENSE.txt).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkj-is%2Fpathbuilder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmkj-is%2Fpathbuilder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkj-is%2Fpathbuilder/lists"}