Meniny / DaVinci

πŸ–Œ More modern CoreGraphics wrapper for iOS/macOS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Meet DaVinci

DaVinci

Author EMail MIT
Version PlatformType Swift
Build Passing Cocoapods Carthage SPM

🏡 Introduction

DaVinci is a more modern CoreGraphics wrapper for iOS/macOS..

πŸ“‹ Requirements

Type Requirement

Platform

iOS

10.0+

macOS

10.10

tvOS

N/A

watchOS

N/A

Linux

N/A

IDE

Xcode

9.3+

Language

Swift

4.1+

πŸ“² Installation

CocoaPods

DaVinci is available on CocoaPods.

use_frameworks!
pod 'DaVinci'

Manually

Copy all files in the DaVinci directory into your project.

πŸ›Œ Dependency

N/A

❀️ Contribution

You are welcome to fork and submit pull requests.

πŸ”– License

DaVinci is open-sourced software, licensed under the MIT license.

πŸ”« Usage

Sample.swift
import DaVinci

public func draw(in context: CGContext, rect: CGRect) {
    let fillColorOne: CGColor = #colorLiteral(red: 0.05, green:0.49, blue:0.98, alpha:0.8).cgColor
    func cal(_ ref: CGFloat, _ acu: CGFloat) -> CGFloat {
        let reference: CGFloat = 66
        return (ref / reference) * acu
    }

    let arrowPartTop = DaVinci.Path.init(point: CGPoint.init(x: cal(11, rect.width), y: rect.midY))
        .addLine(to: CGPoint.init(x: cal(44.5, rect.width), y: 0))
        .addLine(to: CGPoint.init(x: cal(54, rect.width), y: cal(9.5, rect.height)))
        .addLine(to: CGPoint.init(x: cal(30, rect.width), y: rect.midY))
        .close()
    let arrowPartBottom = arrowPartTop.flip(.vertically, by: rect.midY)
    let arrow = arrowPartTop + arrowPartBottom

    context.fill(path: arrow, color: fillColorOne)
}
Sample

About

πŸ–Œ More modern CoreGraphics wrapper for iOS/macOS

License:MIT License


Languages

Language:Swift 98.5%Language:Ruby 1.5%