morphi icon indicating copy to clipboard operation
morphi copied to clipboard

Shapes for SwiftUI ♡☾

Morphi - Μορφ

License Platform Language Build Status Sponsor Become a Patron! Buy me a coffee

Morphi provides some additional shapes for SwiftUI.

Screen shot
  • [x] Triangle
  • [x] Parallelogram(topLeftAngle)
  • [x] Polygon(sides)
  • [x] RoundedPolygon(sides, cornerRadius)
  • [x] Heart
  • [x] Moon(angle)
  • [x] PlusSign(width)
  • [x] Star(points)
  • [x] Wave(isUp, width, offset)
  • [x] SuperEllipse(n)
  • [x] Drop
  • [x] Ring(radius) (to use with a FillStyle with eoFill equal to true)
  • [x] Gear(radius, cogs) (to use with a FillStyle with eoFill equal to true)

Examples

Create a shape view

Like any other shapes just initialize it.

 Heart().fill(Color.red).frame(width: 100, height: 100)
Heart

Mask an existing view

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)
PolygonDrop

UIKit

For UIKit version with UIBezierPath see IBAnimatable framework