A Fast and Complete Swift Drawing(Handwriting) Library
FastDraw is a high performance and highly extensible Drawing(Handwriting) Library that supports Apple Pencil.
- pencil and highlighter, color and width selection
- eraser
- lasso
- export to
sqlite
,pdf
,png
Here is a the demo of FastDraw
FastDrawDemo.mov
Add a basic DrawBoard
import UIKit
import FastDraw
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let drawboardview = DrawBoardView(frame: CGRect(origin: CGPoint(x: 0, y: 100),
size: view.frame.size))
drawboardview.setupDrawing()
self.view.addSubview(drawboardview)
}
}
Update Brush type and color anywhere you like
import UIKit
import FastDraw
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let drawboardview = DrawBoardView(frame: CGRect(origin: CGPoint(x: 0, y: 100),
size: view.frame.size))
drawboardview.setupDrawing()
self.view.addSubview(drawboardview)
Brush.shared.type = .pen
Brush.shared.color = .red
Brush.shared.width = 10
}
}
Try out the FastDrawDemo
Try the app powered by FastDraw CoCreate.
Create Podfile
and add pod FastDraw
:
use_frameworks!
target 'YourApp' do
pod 'FastDraw'
end
Install pods:
pod install
Export to PDF/Image
// drawboardview is a view you have setup before
// export current drawing to URL
drawboardview.drawPDF(url: URL)
drawboardview.drawImage(url: URL)
// export current drawing to URL with background
// use these methods if you have provided a pdf as background of the UIView
drawboardview.drawPDF(pdfpage: CGPDFPage, url: URL)
drawboardview.drawImage(pdfpage: CGPDFPage, url: URL)
Send me an email and I will answer your question and fix problem for you as soon as possible, or you can create an issue if you meet any problems
Contribution is always welcomed! You can create an issue or pull request if you found a bug/implement a new feature/willing to improve the doc.
- Toolbox to set brush
- Stresstest function for FastDrawDemo
- Improve performance of drawing
- Documentation
Collin Zhang
MIT