https://github.com/phimage/morphi
  
  
    Shapes for SwiftUI ♡☾ 
    https://github.com/phimage/morphi
  
heart path shape swift swiftui
        Last synced: about 2 months ago 
        JSON representation
    
Shapes for SwiftUI ♡☾
- Host: GitHub
- URL: https://github.com/phimage/morphi
- Owner: phimage
- License: mit
- Created: 2019-07-17T19:14:07.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-11-08T09:31:41.000Z (almost 6 years ago)
- Last Synced: 2025-03-30T21:01:57.845Z (7 months ago)
- Topics: heart, path, shape, swift, swiftui
- Language: Swift
- Homepage:
- Size: 307 KB
- Stars: 75
- Watchers: 2
- Forks: 2
- Open Issues: 2
- 
            Metadata Files:
            - Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE.txt
 
Awesome Lists containing this project
- fucking-about-SwiftUI - Morphi
- awesome-swiftui-libraries - morphi - Shapes for SwiftUI (Shapes / Content)
README
          # Morphi - Μορφ
[](http://mit-license.org)
[](https://developer.apple.com/resources/)
[](https://developer.apple.com/swift)
[](https://travis-ci.org/phimage/morphi)
[](https://github.com/sponsors/phimage)
 
 
Morphi provides some additional [shapes](https://developer.apple.com/documentation/swiftui/shape) for SwiftUI.

- [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.
```swift
 Heart().fill(Color.red).frame(width: 100, height: 100)
 ```
 
  
 
 ### Mask an existing view
 
 ```swift
 aView.clipShape(Drop())
 // or using static member
 aView.clipShape(.drop)
```
You can even do it on another shape.
```swift
Polygon(sides: 6).fill(Color.red).clipShape(.drop)
```

## UIKit
For `UIKit` version with `UIBezierPath` see [IBAnimatable framework](https://github.com/IBAnimatable/IBAnimatable/)