Provides an iOS view controller allowing a user to draw their signature with their finger in a realistic style.

Related tags

UI ios ios-app
Overview

Uber Signature

Swift version now available!

Mimicking pen-on-paper signatures with a touch screen presents a difficult set of challenges.

The rate touch events are emitted does not provide enough information to mimick the same smooth line the user made with their finger. Simply drawing straight lines between the touch points will yield an unnatural looking line made of discrete sections - especially when the user is moving their finger fast, as the number of touch events stays constant, providing even fewer points per unit of distance moved.

Touches are also collected on the main thread, so any bottleneck on the main thread can adversely affect the frequency with which touches are collected.

Real pen-on-paper signatures vary in line thickness, related to the speed the pen is moved and how hard/soft it is applied to paper. Emulating this requires the use of a more complex drawing routine invloving calculating shapes rather than a line of set weight simply plotted between the touch points.

With UberSignature, we attempted to engineer a solution that feels responsive and produces realistic looking signatures. The implementation separates responsiblities across multiple classes, making the logic easier to understand and maintain. The core algorithm is also written synchronously so its execution can be easily followed. A wrapping class then encapsulates this and provides it asynchronously.

The package provides a SignatureDrawingViewController that detects the touches and draws a signature-styled line as the user moves their finger. It provides the ability to instantiate with a previous image, get current signature image, reset, and change signature color. It can be presented at any size and resizing the view will update the signature accordingly, allowing it to be used in auto-layout environments with ease.

To use:

Instantiate a SignatureDrawingViewController, optionally with an image that will be the starting signature.

ObjC:

[[UBSignatureDrawingViewController alloc] initWithImage:image];

Swift:

SignatureDrawingViewController(image: image)

The view controller can either be presented directly or added as a child view controller. The view can be positioned using auto-layout or the frame set to any needed size. The backing signature image will resize to fit.

Signature Demo

Comments
  • Official package distribution

    Official package distribution

    I see this has already been brought up in #3 but I'd like to raise it again. IMO a 3rd-party fork with a Podfile isn't a great solution as 1) it's already out of date with this repo and 2) it's not in the official package index. UberSignature is an awesome repo – let's make it easier for more people to install and use in their projects!

    @myhrvold @viralplatipuss @jmascia is this something you'd be willing to support? I'd be happy to submit a PR with a Podspec if you guys are on board to publish it to https://cocoapods.org/. It would also be great to support installation via Carthage.

    opened by adamrothman 5
  • fix assigning presentImage in initializer

    fix assigning presentImage in initializer

    presetImage was not being set with optional image. Objc version has it

    - (instancetype)initWithImage:(UIImage *)image
    {
        if (self = [super initWithNibName:nil bundle:nil]) {
            _presetImage = image; // <- HERE!!!!
            _isEmpty = (!image);
            
            _model = [[UBSignatureDrawingModelAsync alloc] init];
        }
        
        return self;
    }
    
    opened by hiimtmac 2
  • Bugfix for signature image initializer

    Bugfix for signature image initializer

    For issue https://github.com/uber/UberSignature/issues/21 and swift sample app updates, also added signature drawing view, useful for table cells when can't use a vc

    opened by marchinram 1
  • Cannot export transparent images

    Cannot export transparent images

    I’m working on an app using Uber Signature that has a white stroke color against a black background. While editing everything works fine, but when I export the image the white stroke is composited onto an opaque white background. Would be nice to support exporting images with transparent background images.

    I’m working on trying to add this, will contribute it back if I can get it working.

    Sent with GitHawk

    opened by timonus 1
  • fix assigning presentImage in initializer

    fix assigning presentImage in initializer

    presetImage was not being set with optional image. Objc version has it

    - (instancetype)initWithImage:(UIImage *)image
    {
        if (self = [super initWithNibName:nil bundle:nil]) {
            _presetImage = image; // <- HERE!!!!
            _isEmpty = (!image);
            
            _model = [[UBSignatureDrawingModelAsync alloc] init];
        }
        
        return self;
    }
    
    opened by hiimtmac 1
  • Reduce the minimum iOS supported version

    Reduce the minimum iOS supported version

    While adding support for CocoaPods (https://github.com/uber/UberSignature/issues/8), the minimum iOS supported version was raised from 8.0 to 11.4.

    I'm not sure if this was an intentional change, but I need to support iOS 10.0.

    @alanzeino can we set a lower minimum iOS supported version?

    Thanks

    opened by 4brunu 1
  • iOS 13.4 Crash on launching UBSignatureDrawingViewController

    iOS 13.4 Crash on launching UBSignatureDrawingViewController

    iOS 13.4 Crash on launching UBSignatureDrawingViewController, it was working fine till upgrading to the latest 13.4.x version. This is what I see in the stack trace,

    Fatal Exception: NSInvalidArgumentException
    index out of bounds for arranged subview: index = 7 expected to be less than or equal to 6
    -[NSCache init]
    

    UIKitCore -[UIStackView insertArrangedSubview:atIndex:]

    opened by harishios 0
  • Why not provide an example that works?

    Why not provide an example that works?

    For such a basic piece of code it would be helpful to provide a working example. Running both the project and workspace result in errors for missing files. For example: UBSignatureDrawingModelAsync file not found. Pods are a waste of time for such a small piece of code. Most developers never update them anyway.

    opened by johnheb 0
  • Passing an image to initializer does nothing

    Passing an image to initializer does nothing

    https://github.com/uber/UberSignature/blob/master/Sources/Swift/SignatureDrawingViewController.swift#L40

    public init(image: UIImage? = nil) {
            super.init(nibName: nil, bundle: nil)
        }
    

    The passed image is not used or shown in view controller when using this initializer, I would expect that when I pass an image to this initializer it would show the image

    opened by marchinram 2
Owner
Uber Open Source
Open Source Software at Uber
Uber Open Source
A controller that uses a UIStackView and view controller composition to display content in a list

StackViewController Overview StackViewController is a Swift framework that simplifies the process of building forms and other static content using UIS

Seed 867 Dec 27, 2022
iOS custom controller used in Jobandtalent app to present new view controllers as cards

CardStackController iOS custom controller used in the Jobandtalent app to present new view controllers as cards. This controller behaves very similar

jobandtalent 527 Dec 15, 2022
Meet Page View Controller for iOS by Cleveroad

While a standard page view allows you to navigate between pages by using simple gestures, our component goes further

Cleveroad 397 Aug 20, 2022
A child view controller framework that makes setting up your parent controllers as easy as pie.

Description Family is a child view controller framework that makes setting up your parent controllers as easy as pie. With a simple yet powerful publi

Christoffer Winterkvist 246 Dec 28, 2022
A library, which adds the ability to hide navigation bar when view controller is pushed via hidesNavigationBarWhenPushed flag

HidesNavigationBarWhenPushed A library, which adds the ability to hide navigation bar when view controller is pushed via hidesNavigationBarWhenPushed

Danil Gontovnik 55 Oct 19, 2022
A set of UIKit helpers that simplify the usage of UIKit view's and controller's in SwiftUI.

A set of UIKit helpers that simplify the usage of UIKit view's and controller's in SwiftUI. Many of these helpers are useful even in a pure UIKit project.

SwiftUI+ 6 Oct 28, 2022
Page view controller with bounce effect

BouncyPageViewController Page view controller with bounce effect inspired by motion design by Stan Yakushevish. Quickstart Create a queue of UIViewCon

Bohdan Orlov 843 Oct 17, 2022
📖 A simple, highly informative page view controller

TL;DR UIPageViewController done properly. ⭐️ Features Simplified data source management & enhanced delegation. Dynamically insert & remove pages. Infi

UI At Six 1.8k Dec 24, 2022
The CITPincode package provides a customizable pincode view

The CITPincode package provides a customizable pincode view. It includes an optional resend code button with a built-in cooldown and an optional divider to be placed anywhere between the cells.

Coffee IT 3 Nov 5, 2022
Full configurable spreadsheet view user interfaces for iOS applications. With this framework, you can easily create complex layouts like schedule, gantt chart or timetable as if you are using Excel.

kishikawakatsumi/SpreadsheetView has moved! It is being actively maintained at bannzai/SpreadsheetView. This fork was created when the project was mov

Kishikawa Katsumi 34 Sep 26, 2022
💾 A collection of classic-style UI components for iOS

A collection of classic-style UI components for UIKit, influenced by Windows 95 Introduction This is a little exploration into applying '90s-era desig

Blake Tsuzaki 2.2k Dec 22, 2022
Pull up controller with multiple sticky points like in iOS Maps

PullUpController Create your own pull up controller with multiple sticky points like in iOS Maps Features Multiple sticky points Landscape support Scr

Mario Iannotta 1.2k Dec 22, 2022
MZFormSheetPresentationController provides an alternative to the native iOS UIModalPresentationFormSheet, adding support for iPhone and additional opportunities to setup UIPresentationController size and feel form sheet.

MZFormSheetPresentationController MZFormSheetPresentationController provides an alternative to the native iOS UIModalPresentationFormSheet, adding sup

Michał Zaborowski 979 Nov 17, 2022
It provides UI components such as popover, popup, dialog supporting iOS apps

Overview LCUIComponents is an on-going project, which supports creating transient views appearing above other content onscreen when a control is selec

Linh Chu 7 Apr 8, 2020
Kit for building custom gauges + easy reproducible Apple's style ring gauges.

GaugeKit ##Kit for building custom gauges + easy reproducible Apple's style ring gauges. -> Example Usage Open GaugeKit.xcworkspace and change the sch

Petr Korolev 1k Dec 23, 2022
Newly is a drop in solution to add Twitter/Facebook/Linkedin style, new updates/tweets/posts available button

Newly is a drop in solution to add Twitter/Facebook/Linkedin style, new updates/tweets/posts available button. It can be used to notify user about new content availability and can other actions can be triggers using its delegate method.

Dhiraj Rajendra Jadhao 197 Sep 22, 2022
Elegant Apply Style by Swift Method Chain.🌙

ApplyStyleKit ApplyStyleKit is a library that applies styles to UIKit using Swifty Method Chain. Normally, when applying styles to UIView etc.,it is n

shindyu 203 Nov 22, 2022
AGCircularPicker is helpful component for creating a controller aimed to manage any calculated parameter

We are pleased to offer you our new free lightweight plugin named AGCircularPicker. AGCircularPicker is helpful for creating a controller aimed to man

Agilie Team 617 Dec 19, 2022