Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/SwiftKitz/Graphicz
Light-weight, operator-overloading-free complements to CoreGraphics!
https://github.com/SwiftKitz/Graphicz
core-graphics geometry ios macos watchos
Last synced: 3 months ago
JSON representation
Light-weight, operator-overloading-free complements to CoreGraphics!
- Host: GitHub
- URL: https://github.com/SwiftKitz/Graphicz
- Owner: SwiftKitz
- License: mit
- Created: 2015-11-17T07:19:55.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-20T11:24:50.000Z (about 7 years ago)
- Last Synced: 2024-04-21T18:26:06.241Z (7 months ago)
- Topics: core-graphics, geometry, ios, macos, watchos
- Language: Swift
- Size: 27.3 KB
- Stars: 45
- Watchers: 5
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ios - Graphicz - Light-weight, operator-overloading-free complements to CoreGraphics! (Graphics / Getting Started)
- awesome-ios-star - Graphicz - Light-weight, operator-overloading-free complements to CoreGraphics! (Graphics / Getting Started)
README
Graphicz :art:
Light-weight, operator-overloading-free complements to CoreGraphics!_Even though I shipped it with my app, I still need to invest the time to set this up, and finalize the API. Contributors welcome!_
## Highlights
+ __Operator Overloading Free:__
It's just an opinion, but this is a crucial difference.+ __Ready For Contributors:__
Basic additions to `CGRect` and other structs added to show contributors the way! PRs welcome! _(I certainly will be submitting some throughout my career)_+ __Full Test Coverage:__
This library requires full test coverage in order to eliminate human error as much as possible.## Features
You can try them in the playground shipped with the framework!
#### CGRect
__Convenient properties:__
```swift
let rect = CGRect(x: 10, y: 10, width: 80, height: 40)
rect.center // x: 50, y: 30
rect.aspectRatio // 2
```__Update functions:__
```swift
var newRect = rect.update(width: 60)
newRect.updateInPlace(x: 20)
newRect.updateInPlace(origin: CGPoint.zero)
```__Edge functions:__
```swift
newRect.insetEdges(left: 20) // Push in the left edge
newRect.insetEdges(bottom: -5) // Push down the bottom
```#### CGVector
__Convenient properties:__
```swift
let vector = CGVector(dx: -5, dy: 0)
vector.angle // π
vector.magnitude // 5
```__Convenient initializers:__
```swift
let unitVector = CGVector(angle: .pi/2)
unitVector.dx // 0
unitVector.dy // 1
```## Motivation
Every once in a while, one might find themself writing layout code manually. Auto layout may work for many, but for the rest of us, doing manual layout calculation is something we do regularly. It does become tedious very quickly, but with the help of such a convenient set of additions, things tend to get simpler and more fun, even.
## Author
Maz ([@Mazyod](http://twitter.com/mazyod))
## License
Graphicz is released under the MIT license. See LICENSE for details.