A cross-platform framework which brings easy to use convenience properties, functions and overloaded operators.
Usage
You can import this module using:
import DLCoreGraphics
A common operation is to round/ceil/floor a number while computing the layout of view. To simplify the work, these functions have been overloaded for CGPoint, CGSize and CGRect.
Since we’re doing layout for devices with different scales, it is helpful to the rounding operations based on the device’s scale. Therefore, there are available 3 new functions: screenRound, screenCeil and screenFloor.
Few examples of operators:
var point = CGPoint(x: 10.0, y: 20.0)
let otherPoint = CGPoint(x: 40.0, y: 30.0)
point += otherPoint
// point == CGPoint(x: 50.0, y: 50.0)
let size = CGSize(width: 100, height: 100.0)
let newSize = size * 3
// newSize == CGSize(width: 300, height: 300.0)
DLCoreGraphics
A cross-platform framework which brings easy to use convenience properties, functions and overloaded operators.
Usage
You can import this module using:
A common operation is to round/ceil/floor a number while computing the layout of view. To simplify the work, these functions have been overloaded for
CGPoint
,CGSize
andCGRect
. Since we’re doing layout for devices with different scales, it is helpful to the rounding operations based on the device’s scale. Therefore, there are available 3 new functions:screenRound
,screenCeil
andscreenFloor
.Few examples of operators:
Finding the middle of right side of a rectangle
And much more are available; check the framework for full details.
Installation
Supported Operating Systems
1. Carthage
If you need the framework only for a single OS, then I propose to use
--platform [iOS|macOS|watchOS|tvOS]
specifier when your performcarthage update
.2. CocoaPods
Add the dependency in your
Podfile
.Note: Currently watchOS is not supported using CocoaPods, please use Carthage instead.
3. Swift Package Manager
Add the the following dependecy in your
Package.swift
:and update your target’s dependencies:
Contribution
Module is covered by unit tests, however, bugs always slip through. If you find a bug in the module create an issue.
If you want to contribute on fixing bugs or implementing new features then create a pull request.
License
DLCoreGraphics is released under MIT license. See LICENSE for details.