What's New

DLCoreGraphics v1.0.0

2018-03-25T12:12:58Z

DLCoreGraphics

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)

Finding the middle of right side of a rectangle

let rectangle = CGRect(x: 10.0, y: 20.0, width: 100, height: 100.0)
let middle = rectanle.middle(forSide: .right)
// middle == CGPoint(x: 110.0, y: 70.0)

And much more are available; check the framework for full details.

Installation

Supported Operating Systems

  • macOS 10.12 and later
  • iOS 10.0 and later
  • watchOS 3.0 and later
  • tvOS 10.0 and later
github "davidlivadaru/DLCoreGraphics"

If you need the framework only for a single OS, then I propose to use --platform [iOS|macOS|watchOS|tvOS] specifier when your perform carthage update.

Add the dependency in your Podfile.

pod 'DLCoreGraphics'

Note: Currently watchOS is not supported using CocoaPods, please use Carthage instead.

Add the the following dependecy in your Package.swift:

dependencies: [
    .package(url: "https://github.com/davidlivadaru/DLCoreGraphics.git", .upToNextMajor(from: "1.0.0"))
]

and update your target's dependencies:

targets: [
        .target(
            name: "YourTargetName",
            dependencies: ["DLCoreGraphics"])),
    ]

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.

Description

  • Swift Tools 4.0.0
View More Packages from this Author

Dependencies

Last updated: Fri Oct 18 2024 22:32:37 GMT-0900 (Hawaii-Aleutian Daylight Time)