CocoaPods trunk is moving to be read-only. Read more on the blog, there are 19 months to go.

DaVinci 2.0.1

DaVinci 2.0.1

Maintained by Meniny.



DaVinci 2.0.1

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