Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kieranb662/SwiftUI-Shapes
Commonly Used Shapes and Utilities In SwiftUI
https://github.com/kieranb662/SwiftUI-Shapes
drawing shapes swift swift-package-manager swiftui
Last synced: 2 months ago
JSON representation
Commonly Used Shapes and Utilities In SwiftUI
- Host: GitHub
- URL: https://github.com/kieranb662/SwiftUI-Shapes
- Owner: kieranb662
- License: mit
- Created: 2020-03-21T23:37:44.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-11-15T19:30:44.000Z (about 4 years ago)
- Last Synced: 2024-08-03T18:13:34.507Z (6 months ago)
- Topics: drawing, shapes, swift, swift-package-manager, swiftui
- Language: Swift
- Size: 2.8 MB
- Stars: 86
- Watchers: 5
- Forks: 18
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-swiftui-libraries - SwiftUI-Shapes - Commonly Used Shapes and Utilities In SwiftUI (Shapes / Content)
README
Commonly used shapes for SwiftUI, some I found on the web [swiftui-lab](https://swiftui-lab.com) and [objc.io](https://www.objc.io/blog/2019/12/16/drawing-trees), others I made myself.
I hope to create community based repo for cool animated shapes, paths, etc. If you would like to submit some of your own shapes just make a pull request and I will try to approve it ASAP. If you want to try out this package just clone the [example project](https://github.com/kieranb662/Shapes-Examples)Or create your own shapes using the [bez editor](https://apps.apple.com/us/app/bez-editor/id1508764103) app available for free on iOS 13.4 and greater.
- **AnyShape**: A type erased `Shape`
- **Lines**
- `Line`
- `HorizontalLine`
- `VerticalLine`
- `AdaptiveLine`- **Triangles**
- `Triangle`
- `OpenTriangle`
- `RightTriangle`- **Graphing**
- `CartesianGrid`
- `TickMarks`
- `PolarGrid`
- `RadialTickMarks`- **Misc**
- `InfinitySymbol`
- `Arrow`
- `Polygon`
- `Pentagon`
- `PathText`
- `FoldableShape`## Lines
### Line
Found at [drawing trees](https://www.objc.io/blog/2019/12/16/drawing-trees). A Line defined by the from and to points.
### Horizontal
A horizontal line that is the width of its container has a single parameter
`offset`: A value between 0 and 1 defining the lines vertical offset in its container (**Default**: 0.5)
### Vertical
A Vertical line that is the height of its container has a single parameter
`offset`: A value between 0 and 1 defining the line's horizontal offset in its container (**Default**: 0.5)
### Adaptive
This shape creates a line centered inside of and constrained by its bounding box.
The end points of the line are the points of intersection of an infinitely long angled line and the container rectangle
## Triangles
The various triangles are shown below.
## Graphing
### Cartesian Grid
A Rectangular grid of vertical and horizontal lines. Has two parameters
`xCount`: The number of vertical lines
`yCount`: The number of horizontal lines
### Polar Grid
A grid made up of concentric circles and angled lines running through their center.
`rCount`: The number of Circles
`thetaCount`: The number of lines
### TickMarks
Tick marks spaced out evenly with varying lengths dependent on the type of tick
minor, semi, or major.The shape has two parameters `spacing: CGFloat` and `ticks: Int`. The spacing is the distance between ticks while the `ticks` is the number of tick marks.
An examples using `TickMarks` are shown below
## Misc
## Arrow
An arrow that starts out small shaped like this |--| but as it grows larger it looks like this <---->
## Pentagon
## Foldable Shapes
## Contributing
If you have an idea for a shape but don't know how to describe it, try out the `PathEditor` tool that comes packaged with [bez](https://github.com/kieranb662/bez)