 		}
 		
 		bezierPath.lineWidth = lineWidth
-		
 		drawColor.setFill()
 		drawColor.setStroke()
-		
 		bezierPath.stroke()
 	}
 


class DrawingView: UIView {
	
	var lastPoint: CGPoint!
	var drawColor = UIColor.blackColor()
	var lineWidth: CGFloat = 5
	
	var counter: Int = 0
	
	var bezierPath: UIBezierPath!
	
	private var preRenderImage: UIImage!
	
	// MARK: Initialization

	override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
		let touch: AnyObject? = touches.first
		lastPoint = touch!.locationInView(self)
		pointCounter = 0
	}
	
	override func touchesMoved(touches: Set<NSObject>, withEvent event: UIEvent) {
		let touch: AnyObject? = touches.first
		var newPoint = touch!.locationInView(self)
		
		bezierPath.moveToPoint(lastPoint)
		bezierPath.addLineToPoint(newPoint)
		lastPoint = newPoint
		
		++pointCounter
		
		if pointCounter == pointLimit {
			pointCounter = 0
			renderToImage()
			setNeedsDisplay()
			bezierPath.removeAllPoints()
		}
		else {
			setNeedsDisplay()
		}
	}
	
	override func touchesEnded(touches: Set<NSObject>, withEvent event: UIEvent) {
		pointCounter = 0
		renderToImage()
		setNeedsDisplay()
		bezierPath.removeAllPoints()
