Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.
/ Verbena Public archive

Get UIImage/NSImage instances from Quartz drawing code or UIView/NSView

License

Notifications You must be signed in to change notification settings

kaishin/Verbena

Folders and files

NameName
Last commit message
Last commit date

Latest commit

2d7e757 · Jun 2, 2019

History

55 Commits
Jun 2, 2019
Jun 2, 2019
Jun 2, 2019
Jun 2, 2019
Jun 2, 2019
Jan 14, 2018
Jan 14, 2018
Jun 8, 2015
Jun 29, 2013
Nov 17, 2015
Jan 14, 2018
Nov 16, 2015
Jun 29, 2013
Jan 14, 2018
Jan 14, 2018
Jun 14, 2015

Repository files navigation

logo

Verbena

GitHub release Carthage compatible CocoaPods Swift 4.0 platforms

A micro-framework that simplifies the task of turning drawing code or views into UIImage/NSImage instances.

Installation

  • Add the following to your Cartfile: github "kaishin/Verbena"
  • Then run carthage update
  • Follow the current instructions in Carthage's README for up to date installation instructions.
  • Add the following to your Podfile: pod 'Verbena'
  • You will also need to make sure you're opting into using frameworks: use_frameworks!
  • Then run pod install.

Usage

import Verbena

// Get a UIImage from drawing block
let image = UIImage.render(CGSize(width: 100, height: 100)) { size in
  // Drawing code goes here. Example:
  // var ovalPath = UIBezierPath(ovalInRect: CGRect(origin: CGPoint(x: 0, y: 0), size: size))
  // UIColor.blackColor().setFill()
  // ovalPath.fill()
}

// Get a UIImage from a UIView
let image = UIImage.image(from: view)

The same methods can also be used on OS X with NSImage instead.

Requirements

  • Swift 4.0+
  • Xcode 9
  • iOS 10+
  • macOS 10.10+

License

Copyright 2013-2018 Reda Lemeden. BSD Licence. See LICENSE file for more info.

About

Get UIImage/NSImage instances from Quartz drawing code or UIView/NSView

Resources

License

Stars

Watchers

Forks

Packages

No packages published