- 0.1.0 and master220.127.116.11.04.2
- 0.1.0 and masteriOSmacOS(Intel)macOS(ARM)LinuxtvOSwatchOS
An animatable SwiftUI Polygon Shape with support for mesh rendering
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.
Using Xcode, select
Swift Packages ->
Add Package Dependency and enter https://github.com/CypherPoet/SwiftUIPolygon.
SwiftUIPolygon can be used through the Swift Package Manager. You can add it as a dependency in your
let package = Package( //... dependencies: [ .package(url: "https://github.com/CypherPoet/SwiftUIPolygon", from: "0.1.0"), ], //... )
From there, you can
import SwiftUIPolygon wherever you'd like to use it.
Polygon( sides: 8, renderingMode: .wireframe )
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.
Polygons with 1 or 2 sides will be rendered as a circle.
An enum type of either
Polygon(sides: 5) .fill(Color.orange) .overlay( polygonShape .stroke(Color.purple, lineWidth: 8) )
SwiftUIPolygon are most welcome. Check out some of the issue templates for more info.
SwiftUIPolygon is available under the MIT license. See the LICENSE file for more info.