Skip to content
This repository was archived by the owner on Dec 31, 2023. It is now read-only.

Latest commit

 

History

History
45 lines (31 loc) · 967 Bytes

File metadata and controls

45 lines (31 loc) · 967 Bytes

iMage

Multiplatform image renderer for MacOS and iOS.

Inspired by EricaSadun and UIGraphicsImageRenderer

Usage

For the best experience use it with Pallete

import iMage
import Palette
let redCirlce = IMage.render(in: someview.bounds) { let ctx = $0.cgContext 
    let ctx = $0.cgContext!
    ctx.setFillColor(.init(.white))
    ctx.fill(rect)
    ctx.addEllipse(in: rect.insetBy(dx: 10, dy: 10))
    ctx.setFillColor(.init(Color<RGB>.red.with(alpha: 0.7)))
    ctx.fillPath()
}

Installation

Add the package to Your SwiftPM package dependencies:

.package(url: "https://github.com/makeupstudio/iMage.git", from: "1.0.0")

then add iMage dependency to your target.

Examples