Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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 (about 5 years ago)
- Default Branch: master
- Last Pushed: 2019-11-08T09:31:41.000Z (almost 5 years ago)
- Last Synced: 2024-07-18T13:22:23.375Z (2 months ago)
- Topics: heart, path, shape, swift, swiftui
- Language: Swift
- Homepage:
- Size: 307 KB
- Stars: 71
- Watchers: 3
- 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 - Μορφ
[![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)
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/)