Morphi provides some additional shapes for SwiftUI.
-
Triangle
-
Parallelogram(topLeftAngle)
-
Polygon(sides)
-
RoundedPolygon(sides, cornerRadius)
-
Heart
-
Moon(angle)
-
PlusSign(width)
-
Star(points)
-
Wave(isUp, width, offset)
-
SuperEllipse(n)
-
Drop
-
Ring(radius)
(to use with aFillStyle
witheoFill
equal totrue
) -
Gear(radius, cogs)
(to use with aFillStyle
witheoFill
equal totrue
)
Like any other shapes just initialize it.
Heart().fill(Color.red).frame(width: 100, height: 100)
aView.clipShape(Drop())
// or using static member
aView.clipShape(.drop)
You can even do it on another shape.
Polygon(sides: 6).fill(Color.red).clipShape(.drop)
For UIKit
version with UIBezierPath
see IBAnimatable framework