Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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 ♡☾

Awesome Lists containing this project

README

        

# Morphi - Μορφ

[![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](http://mit-license.org)
[![Platform](http://img.shields.io/badge/platform-macos_ios_osx_tvos-lightgrey.svg?style=flat)](https://developer.apple.com/resources/)
[![Language](http://img.shields.io/badge/language-swift-orange.svg?style=flat)](https://developer.apple.com/swift)
[![Build Status](https://travis-ci.org/phimage/morphi.svg)](https://travis-ci.org/phimage/morphi)
[![Sponsor](https://img.shields.io/badge/Sponsor-%F0%9F%A7%A1-white.svg?style=flat)](https://github.com/sponsors/phimage)

Become a Patron!


Buy me a coffee

Morphi provides some additional [shapes](https://developer.apple.com/documentation/swiftui/shape) 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.

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

Heart

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

## UIKit

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