Skip to content

Commit

Permalink
Final commit with updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
Awalz committed Dec 1, 2016
1 parent 62180a3 commit bfb7f2d
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 6 deletions.
102 changes: 97 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,117 @@
[![License](https://img.shields.io/cocoapods/l/SwiftyDraw.svg?style=flat)](http://cocoapods.org/pods/SwiftyDraw)
[![Platform](https://img.shields.io/cocoapods/p/SwiftyDraw.svg?style=flat)](http://cocoapods.org/pods/SwiftyDraw)

## Example
## Overview

SwiftyDraw is a simple, lightweight drawing framework written in Swift. SwiftyDraw is built using Core Gaphics and is very easy to implement.


To run the example project, clone the repo, and run `pod install` from the Example directory first.

## Requirements
* iOS 8.0+
* Swift 3.0

## License

SwiftyDraw is available under the BSD license. See the LICENSE file for more info.

## Installation

### Cocoapods:

SwiftyDraw is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:

```ruby
pod "SwiftyDraw"
```

## Author
### Manual Installation:

Andrew Walz, andrewjwalz@gmail.com
Simply copy the contents of the Source folder into your project.

## Usage

Using SwiftyDraw is very simple.

### Getting Started:

Simply create a SwiftyDrawView and add it to your View Controller:

let drawView = SwiftyDrawView(frame: self.view.frame)
self.view.addSubview(drawView)

By default, the view will automatically respond to touch gestures and begin drawing. The default color is **black**.

To disable color, simply set the **drawingEnabled** property to false:

drawView.drawingEnabled = false

## Customization

### Line Color:

The color of a line stoke can be changed by adjusting the **lineColor** property. SwiftyDraw accepts any UIColor:

drawView.lineColor = UIColor.red

<p align="center">
or
</p>
drawView.lineColor = UIColor(colorLiteralRed: 0.75, green: 0.50, blue: 0.88, alpha: 1.0)

### Line Width:

The with of a line stroke can be changed by adjusting the **lineWidth** property. SwiftyDraw accepts any positive CGFloat:

drawView.lineWidth = CGFloat(5.0)

### Line Opacity:

The opacity of a line stoke can be changed by adjusting the **lineOpacity** property. SwiftyDraw accepts a CGFloat between 0. and 1.0:

drawView.lineOpacity = CGFloat(0.5)

## Editing

### Remove Last Line:

SwiftyDraw has the option to clear the last line segment. Simply call the **removeLastLine** function:

drawView.removeLastLine()

This can be called several times, or until the canvas is clear.


### Clear All:

If you wish to clear the entire canvas, simply call the **clearCanvas** function:

drawView.clearCanvas()

## Delegate

SwiftyDraw has delegate functions to notify you when a user is interacting with a SwiftDrawView. To access these delegate methods, simply add your View Controller as the **SwiftyDrawViewDelegate**:

class ViewController: UIViewController, SwiftyDrawViewDelegate

There are four optional delegat methods:

**SwiftyDrawDidBeginDrawing(view: SwiftyDrawView)** - Called when the SwiftyDrawView detects touches have begun.

**SwiftyDrawIsDrawing(view: SwiftyDrawView)** - Called when the SwiftyDrawView detects touches are currrently occuring. Will be called multiple times.

**SwiftyDrawDidFinishDrawing(view: SwiftyDrawView)** - Called when the SwiftyDrawView detects touches have ended for the particular line segment

**SwiftyDrawDidCancelDrawing(view: SwiftyDrawView)** - Called if SwiftyDrawView detects issues with the gesture recognizers and cancels the drawing


### Contact

If you have any questions, requests, or enhancements, feel free to submit a pull request, create an issue, or contact me in person:

**Andrew Walz**
**andrewjwalz@gmail.com**

## License

SwiftyDraw is available under the BSD license. See the LICENSE file for more info.
2 changes: 1 addition & 1 deletion Source/SwiftyDraw.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ open class SwiftyDrawView: UIView {

for line in pathArray {
context.setLineWidth(line.width)
context.setStrokeColor(line.color.cgColor)
context.setAlpha(line.opacity)
context.setStrokeColor(line.color.cgColor)
context.addPath(line.path)
context.beginTransparencyLayer(auxiliaryInfo: nil)
context.strokePath()
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "1"
version = "2.0">
</Bucket>

0 comments on commit bfb7f2d

Please sign in to comment.