Light-weight, operator-overloading-free complements to CoreGraphics!

Overview

Graphicz 🎨

Light-weight, operator-overloading-free complements to CoreGraphics!

Version Version Swift Platforms Carthage

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:

let rect = CGRect(x: 10, y: 10, width: 80, height: 40)
rect.center         // x: 50, y: 30
rect.aspectRatio    // 2

Update functions:

var newRect = rect.update(width: 60)
newRect.updateInPlace(x: 20)
newRect.updateInPlace(origin: CGPoint.zero)

Edge functions:

newRect.insetEdges(left: 20)    // Push in the left edge
newRect.insetEdges(bottom: -5)  // Push down the bottom

CGVector

Convenient properties:

let vector = CGVector(dx: -5, dy: 0)
vector.angle        // π
vector.magnitude    // 5

Convenient initializers:

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)

License

Graphicz is released under the MIT license. See LICENSE for details.

You might also like...
A light-weight server-side service framework written in the Swift programming language.

Smoke Framework The Smoke Framework is a light-weight server-side service framework written in Swift and using SwiftNIO for its networking layer by de

A light-weight TDD / BDD framework for Objective-C & Cocoa
A light-weight TDD / BDD framework for Objective-C & Cocoa

Specta A light-weight TDD / BDD framework for Objective-C. FEATURES An Objective-C RSpec-like BDD DSL Quick and easy set up Built on top of XCTest Exc

Switchboard - easy and super light weight A/B testing for your mobile iPhone or android app. This mobile A/B testing framework allows you with minimal servers to run large amounts of mobile users.

Switchboard - easy A/B testing for your mobile app What it does Switchboard is a simple way to remote control your mobile application even after you'v

Simple and light weight slider with chapter management
Simple and light weight slider with chapter management

Simple and light weight slider with chapter management Demo Installation CocoaPods WESlider is available through CocoaPods. To install it, simply add

A light-weight UITextView subclass that automatically grows and shrinks.
A light-weight UITextView subclass that automatically grows and shrinks.

RSKGrowingTextView A light-weight UITextView subclass that automatically grows and shrinks based on the size of user input and can be constrained by m

A light-weight UITextView subclass that adds support for placeholder.
A light-weight UITextView subclass that adds support for placeholder.

RSKPlaceholderTextView A light-weight UITextView subclass that adds support for placeholder. Installation Using Swift Package Manager To add the RSKPl

DGPlaceholderTextView - A light-weight UITextView that supports for placeholder
DGPlaceholderTextView - A light-weight UITextView that supports for placeholder

DGPlaceholderTextView Requirements Installation Usage Properties DGPlaceholderTe

SVPinView is a light-weight customisable library used for accepting pin numbers or one-time passwords.
SVPinView is a light-weight customisable library used for accepting pin numbers or one-time passwords.

SVPinView SVPinView is a light-weight customisable library used for accepting pin numbers or one-time passwords. Getting Started An example project is

Simple and light weight facebook login library for UIKit & SwiftUI
Simple and light weight facebook login library for UIKit & SwiftUI

MjFbLogin Simple and light weight facebook login library which provides support for UIKit & SwiftUI Example To run the example project, clone the repo

A light-weight, extensible package for building pixel-perfect iOS settings screens.
A light-weight, extensible package for building pixel-perfect iOS settings screens.

SettingsKit A light-weight, extensible package for easily building pixel-perfect iOS settings screens in a pinch. Installation SettingsKit can be inst

Overload +-*/ operator for Swift, make it easier to use (and not so strict)

Easy-Cal-Swift Overview This file is an overloading of +-*/ operator for Swift, to make it easier to use (and not so strict) It can make your life wit

The code for my CoreGraphics+CoreAnimation talk, held during the 2012 iOS Game Design Seminar at the Technical University Munich.

PKCoreTechniques ======= Core Techniques is the result of a presentation I held at the Technical University of Munich during the 'iOS Game Design Semi

An Objective-C wrapper for CoreGraphics CGContext

MPWDrawingContext, version 0.3 An Objective-C wrapper around the CoreGraphics CGContextRef. It includes the MPWDrawingContext protocol and the MPWCGDr

A Swift library for parsing and drawing SVG images to CoreGraphics contexts.

SwiftDraw A Swift library for parsing and drawing SVG images to CoreGraphics contexts. SwiftDraw can also convert an SVG into Swift source code. Usage

Perl-like regex =~ operator for Swift

SwiftRegex Perl-like regex =~ operator for Swift This package implements a =~ string infix operator for use in testing regular expressions and retriev

A library that adds a throwing unwrap operator in Swift.

ThrowingUnwrap A simple package to add a throwing unwrap operator (~!) to Optionals in Swift. Import Add this to the package-wide dependencies in Pack

MyWeight is a body mass tracker focused on make easy to input new data and check your weight history

MyWeight MyWeight is a body mass tracker focused on make easy to input new data and check your weight history. Getting Started Environment prerequisit

This iOS App calculates the weight and balance for a P-3 Orion aircraft.

This iOS App calculates the weight and balance for CBP P-3 Orion aircraft.

Measure the power output from a car or any moving vehicle from GPS data and weight
Measure the power output from a car or any moving vehicle from GPS data and weight

GPSDyno Measure the power output from a car or any moving vehicle from weight and GPS data of your iOS device. This is just a example project and shou

Owner
Kitz
Collection of quality Swift kits
Kitz
An Objective-C wrapper for CoreGraphics CGContext

MPWDrawingContext, version 0.3 An Objective-C wrapper around the CoreGraphics CGContextRef. It includes the MPWDrawingContext protocol and the MPWCGDr

Marcel Weiher 100 Jun 24, 2021
OS font complements library. Localized font supported.

SwiftFontName SwiftFontName is font name complements and supports localized font library. You don't need to search font name any more with SwiftFontNa

Morita Naoki 114 Nov 3, 2022
Light weight tool for detecting the current device and screen size written in swift.

Device detect the current  device model and screen size. Installation CocoaPods Device is available through CocoaPods. To install it, simply add the

Lucas Ortis 1.5k Dec 28, 2022
TTProgressHUD is a light weight HUD written in SwiftUI meant to display the progress of an ongoing task on iOS.

TTProgressHUD TTProgressHUD is a light weight HUD written in SwiftUI meant to display the progress of an ongoing task on iOS. TTProgressHUD (left) was

Tobias Totzek 184 Dec 27, 2022
Light weight charts view generater for iOS. Written in Swift.

# ###Light weight charts view generater for iOS. Written in Swift. Requirements iOS 8.0+ XCode 7.3+ Installation CocoaPods $ pod init specify it in yo

Recruit Holdings. Media Technology Lab 982 Nov 16, 2022
An unintrusive & light-weight iOS app-theming library with support for animated theme switching.

Gestalt Gestalt is an unintrusive and light-weight framework for application theming with support for animated theme switching. Usage Let's say you wa

Vincent Esche 327 Nov 8, 2022
A light weight & simple & easy camera for iOS by Swift.

DKCamera Description A light weight & simple & easy camera for iOS by Swift. It uses CoreMotion framework to detect device orientation, so the screen-

Bannings 86 Aug 18, 2022
Light weight tool for detecting the current device and screen size written in swift.

Device detect the current  device model and screen size. Installation CocoaPods Device is available through CocoaPods. To install it, simply add the

Lucas Ortis 1.5k Dec 28, 2022
FlightLayout is a light weight, and easy to learn layout framework as an extension of the UIView.

FlightLayout Introduction FlightLayout is a light weight, and easy to learn layout framework as an extension of the UIView. Functionally, it lives som

Anton 23 Apr 21, 2022
A light weight network library with automated model parser for rapid development

Gem A light weight network library with automated model parser for rapid development. Managing all http request with automated model parser calls in a

Albin CR 10 Nov 19, 2022