All Projects → dehli → Touchdraw

dehli / Touchdraw

Licence: mit
A subclass of UIView which allows you to draw with your fingers.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Touchdraw

Shari
Shari is the alternative to the library of UIPickerView(drum roll) in Swift. You can select a item using UITableView.
Stars: ✭ 111 (-6.72%)
Mutual labels:  cocoapods
Sharaku
(Not maintained)Image filtering UI library like Instagram.
Stars: ✭ 1,497 (+1157.98%)
Mutual labels:  cocoapods
Swifty360player
iOS 360-degree video player streaming from an AVPlayer.
Stars: ✭ 118 (-0.84%)
Mutual labels:  cocoapods
Rough Charts
📈 A responsive, composable react charting library with a hand-drawn style.
Stars: ✭ 1,485 (+1147.9%)
Mutual labels:  drawing
Fontawesome.swift
Use FontAwesome in your Swift projects
Stars: ✭ 1,513 (+1171.43%)
Mutual labels:  cocoapods
Rhythmbox
A Rhythm Box System for your iOS app written in Swift. 🎵
Stars: ✭ 116 (-2.52%)
Mutual labels:  cocoapods
Randomkit
Random data generation in Swift
Stars: ✭ 1,458 (+1125.21%)
Mutual labels:  cocoapods
Swiftuiblurview
This view is also part of SwiftUIKit: https://github.com/danielsaidi/SwiftUIKit
Stars: ✭ 120 (+0.84%)
Mutual labels:  cocoapods
Lightweightobservable
📬 A lightweight implementation of an observable sequence that you can subscribe to.
Stars: ✭ 114 (-4.2%)
Mutual labels:  cocoapods
Towebviewcontroller
A view controller class for iOS that allows users to view web pages directly within an app.
Stars: ✭ 1,500 (+1160.5%)
Mutual labels:  cocoapods
Bottomsheet
Component which presents a dismissible view from the bottom of the screen.
Stars: ✭ 113 (-5.04%)
Mutual labels:  cocoapods
Uilabel Copyable
A simple category to add copy functionality to UILabel.
Stars: ✭ 113 (-5.04%)
Mutual labels:  cocoapods
Swiftloader
A simple and beautiful activity indicator written in Swift
Stars: ✭ 116 (-2.52%)
Mutual labels:  cocoapods
Microfeatures Example
📦📱 Example of iOS app built using the uFeatures architecture
Stars: ✭ 112 (-5.88%)
Mutual labels:  cocoapods
Dddkit
360 video player for iOS written in swift - a subset of SceneKit that works
Stars: ✭ 118 (-0.84%)
Mutual labels:  cocoapods
Device
Light weight tool for detecting the current device and screen size written in swift.
Stars: ✭ 1,503 (+1163.03%)
Mutual labels:  cocoapods
Foundationextension
Foundation/Cocoa/UIKit extension kit. Reference document:
Stars: ✭ 115 (-3.36%)
Mutual labels:  cocoapods
Actionclosurable
Extensions which helps to convert objc-style target/action to swifty closures
Stars: ✭ 120 (+0.84%)
Mutual labels:  cocoapods
Sqift
Powerful Swift wrapper for SQLite
Stars: ✭ 119 (+0%)
Mutual labels:  cocoapods
Emspinnerbutton
UIButton sublcass with loading animation
Stars: ✭ 117 (-1.68%)
Mutual labels:  cocoapods

TouchDraw

Join the chat at https://gitter.im/dehli/TouchDraw

The TouchDraw module allows you to use the TouchDrawView class. This is a subclass of UIView which allows you to draw pictures with your finger.

Installation

The easiest way to include TouchDraw is by using CocoaPods and adding the following to your Podfile.

use_frameworks!
pod 'TouchDraw', '~> 2.1'

If you're not using CocoaPods, you can add the TouchDrawView.swift file to your project.

Usage

You can either programmatically add the TouchDrawView or add it using storyboards.

Storyboards

If using storyboards, you must add a UIView to your storyboard. Give it the TouchDrawView class, and TouchDraw module.

Storyboard class

Code

If programmatically adding the view, you can use the init(frame: CGRect) method to create a new instance of TouchDrawView. You must make sure to write import TouchDraw at the top of the class, and also set isUserInteractionEnabled to true.

Customizing

When customizing the TouchDrawView you can setting its delegate. The container can conform to parts of TouchDrawViewDelegate, which has the following functions:

func undoEnabled() {
    // triggered when undo is enabled
    // (only if it was previously disabled)
}
func undoDisabled() {
    // triggered when undo is disabled
    // (only if it previously enabled)
}
func redoEnabled() {
    // triggered when redo is enabled
    // (only if it was previously disabled)
}
func redoDisabled() {
    // triggered when redo is disabled
    // (only if it previously enabled)
}
func clearEnabled() {
    // triggered when clear is enabled
    // (only if it was previously disabled)
}
func clearDisabled() {
    // triggered when clear is disabled
    // (only if it previously enabled)
}

The TouchDrawView exposes the following methods:

  • exportDrawing() -> UIImage
    • Exports a UIImage version of the drawing.
  • clearDrawing()
    • Clears the TouchDrawView.
  • undo()
    • Undo the last stroke.
  • redo()
    • Redo what was undone.
  • setColor(color: UIColor?)
    • Sets the color of future strokes, if you pass nil you will be erasing.
  • setWidth(width: CGFloat)
    • Sets the width of future strokes.
  • importStack(stack: [Stroke])
    • Set the TouchDrawView to have certain strokes (usually will be used in conjunction with exportStack().
  • exportStack() -> [Stroke]
    • Exports the strokes from a TouchDrawView so they can be imported later.

Demo

If you'd like to see this library in action, you can download the entire repository and open Demo/TouchDrawDemo.xcworkspace.

Demo/TouchDrawDemo/ViewController.swift is where most of its functionality is demonstrated.

Demo Screenshot

License

This package has the MIT license, which can be found here: LICENSE.

Code of Conduct

Please make sure to follow the Code of Conduct when you interact with this project. Thanks!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].