Get Updates By E-mail 

Article Written By:
Johann Dowa

InkKit – Swift Library That Simplifies Many Common Graphics Related Tasks Such As Gradient Fills


InkKit from Shaps M is a Swift based library simplifying many common drawing related tasks.

  • Simplified draawing of lines, paths, and fills
  • Filling graphical objects with gradients
  • Drawing images with simple scaling, alignment and blending options
  • Drawing of text with easy alignment to
  • Geometry utility functions

This code snippet from the readme shows how one could draw a gradient filled rectangle with text and a circle:

let (leftRect, rightRect) = frame.divide(atDelta: 0.5, fromEdge: .MinXEdge, margin: 10)
let start = Color.whiteColor()
let end = Color.blackColor()
let leftPath = BezierPath(rect: leftRect)

// fill the left rect with a 90º gradient
Draw.fillPath(leftPath, startColor: start, endColor: end, angleInDegrees: 90)

// draw some text, aligned to the right rect
"InkKit is so awesome!".drawAlignedTo(rightRect, horizontal: .Center, vertical: .Middle)

// create an image of a circle (with a radius of 5pt) and draw it 10) { (attributes) in
  attributes.strokeColor = Color.blackColor()
  attributes.fillColor = Color.redColor().colorWithAlphaComponent(0.5)
  attributes.dashPattern = [1, 4]
  attributes.lineWidth = 2
}.drawAtPoint(CGPointMake(0, 0))

You can find InkKit on Github here.

A nice graphics helper library.


Submit A Resource

Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?

You can submit the url here.

The resources we feel will appeal to our readers the most will be posted on the front page.