Navigation Menu

Skip to content

Dingo203/fishPaint

Repository files navigation

fishPaint

Platform: iOS 8+ Xcode: 8.0+ Language: Swift 3 CocoaPods compatible

Overview

FishPaint is a lightweight framework that offers a paint view for user written in Swift. FishPaint is built by using Core Gaphics.

Requirements

  • iOS 8.0+
  • Xcode 8.0+
  • Swift 3.0

Installation

Cocoapods:

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

pod "fishPaint"

Manual Installation:

Simply copy the contents of the 'Class' folder into your project.

Demo Screen Shot

Usage

Getting Started:

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

let paintView = fishPaintView(frame: self.view.frame)
self.view.addSubview(paintView)

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

Customization properties:

You can customization the properties for the fishPaintView, like drawingEnabled,lineWidth,lineOpacity,lineColor:

paintView.drawingEnabled = false
paintView.lineWidth = CGFloat(12.0)
paintView.lineOpacity = CGFloat(1.0)
paintView.lineColor = UIColor.white

Edit action:

FishPaint can let user to delete the last line segment. Simply call the removeLastLine function:

paintView.removeLastLine()

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

paintView.clearCanvas()

Delegate

FishPaint offers delegate functions to response user's reaction with a fishPaintView. To access these delegate methods, simply add your View Controller as the fishPaintViewDelegate :

class ViewController: UIViewController, fishPaintViewDelegate

There are four optional delegate methods:

func fishPaintDidBeginDrawing(view: fishPaintView)
    
func fishPaintIsDrawing(view: fishPaintView)
    
func fishPaintDidFinishDrawing(view: fishPaintView)
    
func fishPaintDidCancelDrawing(view: fishPaintView)

License

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

About

offer a easy way for fish to use paint

Resources

License

Stars

Watchers

Forks

Packages

No packages published