All Projects → mkj-is → PathBuilder

mkj-is / PathBuilder

Licence: MIT License
SwiftUI result builder for Path

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to PathBuilder

awesome-result-builders
A list of cool DSLs made with Swift 5.4’s @resultBuilder
Stars: ✭ 805 (+1577.08%)
Mutual labels:  swiftui, functionbuilder, resultbuilder
SwiftRegexDSL
A Declarative Structured Language for regular expressions in Swift.
Stars: ✭ 147 (+206.25%)
Mutual labels:  functionbuilder, resultbuilder
SwiftUI-bez
Utilities for working with bezier curves in SwiftUI
Stars: ✭ 80 (+66.67%)
Mutual labels:  path, swiftui
NavigationRouter
A router implementation designed for complex modular apps, written in Swift
Stars: ✭ 89 (+85.42%)
Mutual labels:  path, swiftui
SettingsAppInSwiftUI
I have recreated a Settings App in iPhoneXR using SwiftUI concepts such as Form,Section,Toggle,Picker,Stack..etc
Stars: ✭ 37 (-22.92%)
Mutual labels:  swiftui
Colorful
CSS colors for use with SwiftUI
Stars: ✭ 23 (-52.08%)
Mutual labels:  swiftui
iOS interviews
iOS Interviews - 史上最贴心 iOS 面试知识点分享!不只是 iOS !只为技术的执拗 !👍 全网火速更新中 🔥 期待你的讨论,期待你的 issue ! 🌟
Stars: ✭ 25 (-47.92%)
Mutual labels:  swiftui
RRSettingsKit
A beautiful customizable settings screen created in SwiftUI
Stars: ✭ 118 (+145.83%)
Mutual labels:  swiftui
tapit-app
App which lets two people share their social media details by simply putting one phone on top of the other ("tapping"). Currently in development by Nikita Mounier.
Stars: ✭ 18 (-62.5%)
Mutual labels:  swiftui
Helm
A graph-based SwiftUI router
Stars: ✭ 64 (+33.33%)
Mutual labels:  swiftui
column-text-view-ui
📄 Column Text View is an adaptive UI component that renders text in columns, horizontally [iOS 12, UIKit, TextKit, SwiftUI].
Stars: ✭ 11 (-77.08%)
Mutual labels:  swiftui
SwiftyIllustrator
A tool for quickly converting Adobe Illustrator shapes into SwiftUI code.
Stars: ✭ 26 (-45.83%)
Mutual labels:  swiftui
ColorUp
An easy way to generate strongly typed Swift extensions for either UIColor or Color based off of your colors within the project's asset catalog.
Stars: ✭ 16 (-66.67%)
Mutual labels:  swiftui
chip-8
Jetpack Compose and SwiftUI based Kotlin Multiplatform fork of https://github.com/cbeust/chip-8 (Chip-8 Emulator)
Stars: ✭ 36 (-25%)
Mutual labels:  swiftui
SwiftUI-Shimmer
Shimmer is a super-light modifier that adds a shimmering effect to any SwiftUI View, for example, to show that an operation is in progress. It works well on light and dark modes, and across iOS, macOS, tvOS and watchOS.
Stars: ✭ 168 (+250%)
Mutual labels:  swiftui
SwimplyPlayIndicator
Animated PlayIndicator written in SwiftUI. Inspired by Apple's Music Player.
Stars: ✭ 52 (+8.33%)
Mutual labels:  swiftui
aws-serverless-fullstack-swift-apple-carplay-example
This application demonstrates a full-stack Apple CarPlay app that uses Swift for both the UI and the backend services in AWS. The app accesses Lambda functions written in Swift and deployed from Docker images. The app accesses Amazon Location Service and a 3rd party weather api to display information in the vicinity of the user.
Stars: ✭ 84 (+75%)
Mutual labels:  swiftui
is-relative
Returns `true` if a file path appears to be relative. Moved from the "relative" lib.
Stars: ✭ 13 (-72.92%)
Mutual labels:  path
SwiftUI-Fractals
The Sierpinski carpet, triangle, and a fractal tree using SwiftUI
Stars: ✭ 22 (-54.17%)
Mutual labels:  swiftui
requireg
Resolve and require local & global modules in node.js like a boss
Stars: ✭ 45 (-6.25%)
Mutual labels:  path

PathBuilder logo

PathBuilder

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.

Motivation

I just wanted to learn to implement result builders. And during playing with animated paths in SwiftUI found a perfect place to experiment.

Usage

Examples

With PathBuilder you can write this to draw a triangle:

Path {
    Move(to: CGPoint(x: 50, y: 50))
    Line(to: CGPoint(x: 100, y: 100))
    Line(to: CGPoint(x: 0, y: 100))
    Close()
}

Instead of longer version:

Path { p in
    p.move(to: CGPoint(x: 50, y: 50))
    p.addLine(to: CGPoint(x: 100, y: 100))
    p.addLine(to: CGPoint(x: 0, y: 100))
    p.closeSubpath()
}

Drawing a Swift logo can be implemented like this.

Swift logo path drawing using PathBuilder

Path components

There are many basic path components present. You can create a new one by conforming to the PathComponent protocol.

Elementary components

  • Arc – Adds an arc of a circle to the path, specified with a radius and angles.
  • Close – Closes and completes a subpath in a path.
  • Curve – Adds a cubic Bézier curve to the path, with the specified end point and control points.
  • Oval – Adds an ellipse that fits inside the specified rectangle.
  • EmptySubpath – Adds empty subpath, used mainly as a temporary placeholder.
  • Line – Appends a straight line segment from the current point to the specified point.
  • Lines – Adds a sequence of connected straight-line segments to the path.
  • Move – Begins a new subpath at the specified point.
  • QuadCurve – Adds a quadratic Bézier curve to the path, with the specified end point and control point.
  • Rect – Adds a set of rectangular subpaths to the path.
  • RelativeArc – Adds an arc of a circle to the path, specified with a radius and a difference in angle.
  • RoundedRect – Adds a subpath to the path, in the shape of a rectangle with rounded corners.
  • TangentArc – Adds an arc of a circle to the path, specified with a radius and two tangent lines.

Grouping components

  • Loop – Appends components to path iterating over supplied sequence and building path for each element.
  • Subpath – Groups and appends another subpath object to the path and optionally transforms it.

Requirements

For Swift 5.1 to 5.3 use package version 1.1.1.

Otherwise for version 2.0+ use latest tools:

  • Xcode 12.5 or above
  • Swift 5.4 or above
  • iOS 13, macOS 10.15, watchOS 6.0, tvOS 13.0 or above

Installation

Using Swift Package Manager in Xcode or by adding to your Package manifest file.

Contributing

All contributions are welcome.

Project was created by Matěj Kašpar Jirásek.

Project is licensed under MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].