Latest 2.0.0
Homepage https://github.com/jamiebanford/DrawingKit
License MIT
Platforms ios 11.0
Frameworks UIKit
Authors

CI Status
Version
License
Platform

Simple, fast, freehand drawing for UIKit.

Example

To run the example project, clone the repo, and run pod install from the Example directory first. The example project demonstates how to use DrawingKit with a container view in a storyboard to make a simple drawing app.

Overview

DrawingKit uses UITouch events to create composite Bézier curves. After drawing the curves into the view the they are quickly saved to an image to avoid redrawing the same curves repeatedly.

Drawing happens in the view of a DrawingViewController class. In any file which imports DrawingKit the drawing view controller class will be available to use. Simply add the drawing view controller as a child view controller and a new drawing view will be available. The DrawingViewController can also be used in Storyboards.

By default DrawingKit draws black lines, 1pt thick, on a white background, with round line caps. These can all be customised by setting the appropriate properties on the DrawingViewController. For example, to draw thick white lines on a black background simply set the appropriate properties on the view controller:

drawingViewController.set(lineWidth: 20)
drawingViewController.set(backgroundColor: .black)
drawingViewController.set(lineColor: .white)

The DrawingViewController also provides access to the UIImage currently displayed, and a function to clear the current drawing. Saving and clearing the current image is as simple as

if let currentImage = drawingViewController.currentImage {
// Do something with the image
}
drawingViewController.clearDrawing()

That’s it! DrawingKit makes makes freehand drawing in iOS a cinch. The rest is up to you.

Requirements

DrawingKit requires iOS 11.0 or newer.

Installation

DrawingKit is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'DrawingKit'

Author

Jamie Banford

License

DrawingKit is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "DrawingKit",
    "version": "2.0.0",
    "summary": "Simple, fast, freehand drawing for UIKit.",
    "description": "DrawingKit provides simple Swift API to add freehand drawing to any iOS project. It chains together touches to form smooth composite Bu00e9zier curves and quickly draws them to the screen. All curves are saved to an image shortly after drawing, and that image is available for the host application to use. Line colour, background colour, and line thickness are all easily customisable. DrawingKit is perfect for easily capturing a signature or other user input.",
    "homepage": "https://github.com/jamiebanford/DrawingKit",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Jamie Banford": "[email protected]"
    },
    "source": {
        "git": "https://github.com/jamiebanford/DrawingKit.git",
        "tag": "2.0.0"
    },
    "social_media_url": "https://twitter.com/jamie_banford",
    "swift_version": "4.0",
    "platforms": {
        "ios": "11.0"
    },
    "source_files": "DrawingKit/Classes/**/*",
    "frameworks": "UIKit"
}

Pin It on Pinterest

Share This