An animatable SwiftUI Polygon Shape with support for mesh rendering.
🔗Clone or download this repo and play around with the Demo app.
SwiftUIPolygon aims to provide a primitive Shape implementation that can be rendered as any n-sided polygon in its regular form – with support for animating side-count changes in real time. As bonus, you can configure it to render just the face – or render the inner edges for a “wireframe” effect.
Contributions to SwiftUIPolygon are most welcome. Check out some of the issue templates for more info.
Developing
Generating Documentation
Documentation is generated by Jazzy. Installation instructions can be found here, and as soon as you have it set up, docs can be generated simply by running jazzy from the command line.
License
SwiftUIPolygon is available under the MIT license. See the LICENSE file for more info.
SwiftUIPolygon
An animatable SwiftUI Polygon Shape with support for mesh rendering.
SwiftUIPolygon aims to provide a primitive
Shape
implementation that can be rendered as any n-sided polygon in its regular form – with support for animating side-count changes in real time. As bonus, you can configure it to render just the face – or render the inner edges for a “wireframe” effect.Features
Requirements
Installation
Xcode Projects
Using Xcode, select
File
->Swift Packages
->Add Package Dependency
and enter https://github.com/CypherPoet/SwiftUIPolygon.Swift Package Manager
SwiftUIPolygon
can be used through the Swift Package Manager. You can add it as a dependency in yourPackage.swift
file:From there, you can
import SwiftUIPolygon
wherever you’d like to use it.Usage
Configurable Properties
sides (
Int
)The number of sides belonging to the polygon.
This value must be greater than or equal to 1. If a value less than 1 is set, it will be clamped to 1 automatically.
renderingMode (
Polygon.MeshRenderingMode
)An enum type of either
face
orwireframe
.Recipes
Stroking and filling the same shape
Roadmap
Contributing
Contributions to
SwiftUIPolygon
are most welcome. Check out some of the issue templates for more info.Developing
Generating Documentation
Documentation is generated by Jazzy. Installation instructions can be found here, and as soon as you have it set up, docs can be generated simply by running
jazzy
from the command line.License
SwiftUIPolygon is available under the MIT license. See the LICENSE file for more info.