Lightweight touch visualization library in Swift. A single line of code and visualize your touches!

Related tags

UI TouchVisualizer
Overview

TouchVisualizer

Version License Platform Carthage compatible Circle CI Join the chat at https://gitter.im/morizotter/TouchVisualizer

TouchVisualizer is a lightweight pure Swift implementation for visualising touches on the screen.

Features

  • Works with just a single line of code!
  • Supports multiple fingers.
  • Supports multiple UIWindow's.
  • Displays touch radius (finger size).
  • Displays touch duration.
  • Customise the finger-points image and colour.
  • Supports iPhone and iPad in both portrait and landscape mode.

How it looks

Portrait:

one

Landscape:

two

Robots:

three

In-app implementation:

four

It's fun!

Runtime Requirements

  • Swift 4.0
  • Xcode 9.2
  • iOS9.0 or later

TouchVisualizer works with Swift 5.2 from version 4.0.0.

Installation and Setup

Note: Embedded frameworks require a minimum deployment target of iOS 9.0.

Information: To use TouchVisualizer with a project targeting iOS 8.0 or lower, you must include the TouchVisualizer.swift source file directly in your project.

Installing with CocoaPods

CocoaPods is a centralised dependency manager that automates the process of adding libraries to your Cocoa application. You can install it with the following command:

$ gem update
$ gem install cocoapods
$ pods --version

To integrate TouchVisualizer into your Xcode project using CocoaPods, specify it in your Podfile and run pod install.

platform :ios, '9.0'
use_frameworks!
pod "TouchVisualizer", '~> 4.0'

Installing with Carthage

Carthage is a decentralised dependency manager that automates the process of adding frameworks to your Cocoa application.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate TouchVisualizer into your Xcode project using Carthage, specify it in your Cartfile:

github "morizotter/TouchVisualizer" "4.0.0"

Manual Installation

To install TouchVisualizer without a dependency manager, please add all of the files in /Pod to your Xcode Project.

Usage

To start using TouchVisualizer, write the following line wherever you want to start visualising:

import TouchVisualizer

Then invoke visualisation, by calling:

Visualizer.start()

and stop the presentation like this:

Visualizer.stop()

Get touch locations by this:

Visualizer.getTouches()

It is really simple, isn't it?

Customisation

TouchVisualizer also has the ability to customize your touch events. Here is an example of what can be customized:

var config = Configuration()
config.color = UIColor.redColor()
config.image = UIImage(named: "YOUR-IMAGE")
config.showsTimer = true
config.showsTouchRadius = true
config.showsLog = true
Visualizer.start(config)

Configuration properties

name type description default
color UIColor Color of touch point and text. default color
image UIImage Touch point image. If rendering mode is set to UIImageRenderingModeAlwaysTemplate, the image is filled with color above. circle image
defaultSize CGSize Default size of touch point. 60 x 60px
showsTimer Bool Shows touch duration. false
showsTouchRadius Bool Shows touch radius by scaling touch point. It doesn't work on simulator. false
showsLog Bool Shows log. false

Documentation

Peripheral

Presentation

Contributing

Please file issues or submit pull requests for anything youโ€™d like to see! We're waiting! :)

Licensing

TouchVisualizer is released under the MIT license. Go read the LICENSE file for more information.

Miscellaneous

There is a similar touch visualization library called COSTouchVisualizer, which is written in Objective-C. COSTouchVisualizer supports earlier versions of iOS and is more mature. If TouchVisualizer isn't enough for you, try that!

Comments
  • Add getTouches() in Visualizer extension for getting touch locations.

    Add getTouches() in Visualizer extension for getting touch locations.

    Hi, morizotter! I am using your framework TouchVisualizer in my app. But I found that I cannot get the touch locations from your framework. So I add a method called getTouches() in your extension to get touch locations. Hope you can accept this pull request, and update your CocoaPods version so that I can download it from CocoaPods directly. Best wishes!

    opened by lm2343635 5
  • Version 1.2.1 has problem?

    Version 1.2.1 has problem?

    The new version has a preblem,use of unresoled identifier "warnIfSimulator",and UIWindow does not hav e a member named swizle,anyone konw why?and I can not find TouchVisualizer.swift?

    opened by xiaoxidong 4
  • Spelling correction and two bug fixes

    Spelling correction and two bug fixes

    bug fix - stop removes all touch views from view and prevents new ones from populating ---- previously calling TouchVisualizer.stop() would not stop new touches from showing on the screen

    bug fix - changing config in TouchVisualizer adjusts new and previously created TouchViews ---- previously if you set a new config (Example: you want touches to be a different colors in different views) any previously created touchViews would not update

    bug 
    opened by sixfngers 4
  • Xcode 11.4 compile errors with TouchVisualizer cocoapod

    Xcode 11.4 compile errors with TouchVisualizer cocoapod

    New xcode 11.4 update produces these errors (using latest TouchVisualizer 3.1.0 cocoapod):

    <...>/Pods/TouchVisualizer/TouchVisualizer/Visualizer.swift:153:13: Switch must be exhaustive
    <...>/Pods/TouchVisualizer/TouchVisualizer/Visualizer.swift:153:13: Do you want to add missing cases?
    <...>/Pods/TouchVisualizer/TouchVisualizer/Visualizer.swift:209:13: Switch must be exhaustive
    <...>/Pods/TouchVisualizer/TouchVisualizer/Visualizer.swift:209:13: Do you want to add missing cases?
    

    Changes that fix build errors, but may not be correct:

    @@ -179,6 +179,10 @@
                     }
                     
                     log(touch)
    +            case .regionEntered, .regionMoved, .regionExited:
    +                log(touch)
    +            @unknown default:
    +                log(touch)
                 }
             }
         }
    @@ -212,6 +216,8 @@
                 case .stationary: phase = "S"
                 case .ended: phase = "E"
                 case .cancelled: phase = "C"
    +            case .regionEntered, .regionMoved, .regionExited: phase = ""
    +            @unknown default: phase = ""
                 }
                 
                 let x = String(format: "%.02f", view.center.x)
    
    opened by lietusme 3
  • Swift 4/Xcode9 Support

    Swift 4/Xcode9 Support

    Hello! Can we get a quick update for xcode9/swift4 support?

    It looks like all the library needs is 3 auto-correct fixes. I can PR them if you like, but they should be super fast either way.

    opened by RamblinWreck77 3
  • Pod version slightly outdated in `pod search` result

    Pod version slightly outdated in `pod search` result

    When I perform pod search TouchVisualizer it shows that the latest version is 3.0.1, but I am still able to use latest version mentioned here with pod "TouchVisualizer", '~>3.0.2'.

    I have never created or published a pod before so I'm not sure how to keep the pod info updated, but just a heads-up ๐Ÿ‘ screenshot 2018-05-22 16 47 28

    opened by pt2277 2
  • Displaying touches on windows other than the key window

    Displaying touches on windows other than the key window

    In our project we are using a custom keyboard and were having difficult showing touches over it. The issue is that Visualizer always adds the TouchView to the keyWindow, but sometimes other windows are over the keyWindow.

    We can fix this for our own purposes to use the topmost (as determined by windowLevel) visible window but were wondering if there was any interest in adding that functionality to the main repo. Happy to submit a PR.

    opened by tsabend 2
  • Swift 3

    Swift 3

    Hello and thanks for this framework,

    Is there a Swift 3 branch on its way?

    I can't use it with Xcode 8 and Swift 3 beta and Cocoapods... Or couldn't find how to.

    Thanks!

    opened by Tulleb 2
  • Bump cocoapods-downloader from 1.1.3 to 1.6.3

    Bump cocoapods-downloader from 1.1.3 to 1.6.3

    Bumps cocoapods-downloader from 1.1.3 to 1.6.3.

    Release notes

    Sourced from cocoapods-downloader's releases.

    1.6.3

    Enhancements
    • None.
    Bug Fixes
    • None.

    1.6.2

    Enhancements
    • None.
    Bug Fixes
    • None.

    1.6.1

    Enhancements
    • None.
    Bug Fixes
    • None.

    1.6.0

    Enhancements
    • None.
    Bug Fixes
    • Adds a check for command injections in the input for hg and git.
      orta #124

    1.5.1

    Enhancements
    • None.
    Bug Fixes
    • Fix "can't modify frozen string" errors when pods are integrated using the branch option
      buju77 #10920

    1.5.0

    ... (truncated)

    Changelog

    Sourced from cocoapods-downloader's changelog.

    1.6.3 (2022-04-01)

    Enhancements
    • None.
    Bug Fixes
    • None.

    1.6.2 (2022-03-28)

    Enhancements
    • None.
    Bug Fixes
    • None.

    1.6.1 (2022-03-23)

    Enhancements
    • None.
    Bug Fixes
    • None.

    1.6.0 (2022-03-22)

    Enhancements
    • None.
    Bug Fixes
    • Adds a check for command injections in the input for hg and git.
      orta #124

    1.5.1 (2021-09-07)

    Enhancements
    • None.

    ... (truncated)

    Commits
    • c03e2ed Release 1.6.3
    • f75bccc Disable Bazaar tests due to macOS 12.3 not including python2
    • 52a0d54 Merge pull request #128 from CocoaPods/validate_before_dl
    • d27c983 Ensure that the git pre-processor doesn't accidentally bail also
    • 3adfe1f [CHANGELOG] Add empty Master section
    • 591167a Release 1.6.2
    • d2564c3 Merge pull request #127 from CocoaPods/validate_before_dl
    • 99fec61 Switches where we check for invalid input, to move it inside the download fun...
    • 96679f2 [CHANGELOG] Add empty Master section
    • 3a7c54b Release 1.6.1
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 1
  • Update swizzling trigger

    Update swizzling trigger

    Issue If Visualizer.sharedInstance is not invoked before app is active, calling start function won't work. This is because the swizzling relies on the appBecomeActive notification, and the notification registration is upon initialization of Visualizer.

    Fix

    • Put the swizzling function in the initialization process of Visualizer.sharedInstance. This guarantees whenever the start is called, we'll always get the function swizzled.
    • Remove the unnecessary bool check: As the singleton is guaranteed to be executed once in the application lifecycle, we won't need to worry about the function gets swizzled back.
    opened by congsun 0
  • Why do I have to reactivate my app for this to work?

    Why do I have to reactivate my app for this to work?

    I have a triple/triple click easter egg I use to toggle this on/off. It's great for making instructional videos. I find that the first time it gets turned on, it won't take until I switch away and back to my app to start seeing this visualization. After that initial swap, it toggles on and off just fine. It's just the first activation that doesn't take without an additional application reactivation.

    opened by travisgriggs 1
  • In ReplayKit recording the touch is not shown

    In ReplayKit recording the touch is not shown

    I have been working on to show the touch visualizer on the video I recorded with ReplayKit but it is not showing any touch at all. What could be the problem?

    opened by mehmetbaykar 0
  • Replace NSTimer with CADisplayLink

    Replace NSTimer with CADisplayLink

    An NSTimer is not the optimal way to draw stuff to the screen that needs to refresh every frame. CADisplayLink is way better. It always fires immediately prior to the screen being redrawn.

    opened by gaetanzanella 0
Releases(4.0.0)
Owner
Morita Naoki
Traveller.
Morita Naoki
Anchorage - Single file UIView drag and drop system

anchorage Single file UIView drag and drop system anchors.mp4 License Copyright

โ— โ—โ—   โ— 3 Jan 28, 2022
An easy way to add a shimmering effect to any view with just one line of code. It is useful as an unobtrusive loading indicator.

LoadingShimmer An easy way to add a shimmering effect to any view with just single line of code. It is useful as an unobtrusive loading indicator. Thi

Jogendra 1.4k Jan 4, 2023
LicensePlist is a command-line tool that automatically generates a Plist of all your dependencies, including files added manually

LicensePlist is a command-line tool that automatically generates a Plist of all your dependencies, including files added manually(specifi

Masayuki Ono (mono) 2.2k Dec 29, 2022
High performance and lightweight UIView, UIImage, UIImageView, UIlabel, UIButton, Promise and more.

SwiftyUI High performance and lightweight UIView, UIImage, UIImageView, UIlabel, UIButton and more. Features SwiftyView GPU rendering Image and Color

Haoking 336 Nov 26, 2022
Lightweight framework for Unsplash in Swift

Lightweight framework for Unsplash in Swift

Pablo Camiletti 12 Dec 30, 2022
๐Ÿ“– A lightweight, paging view solution for SwiftUI

Getting Started | Customization | Installation Getting Started Basic usage Using Pages is as easy as: import Pages struct WelcomeView: View { @S

Nacho Navarro 411 Dec 29, 2022
A super lightweight popView.

SNAugusPopView Features High performance: The library's dependencies all use system libraries and files , only a instance global. Automatic layout: Th

Augus 11 Sep 1, 2022
NotSwiftUI is designed to help you create UI components quickly and efficiently with code!

NotSwiftUI NotSwiftUI is designed to help you create UI components quickly and efficiently with code! Capitalizing on the idea that most of the UI ele

Jonathan G. 50 Dec 20, 2022
๐Ÿ“ Declarative UIKit in 10 lines of code.

Withable ?? Declarative UIKit in 10 lines of code. See corresponding article at Declarative UIKit with 10 lines of code A simple extension instead of

Geri Borbรกs 14 Dec 20, 2022
Twinkle is a Swift and easy way to make any UIView in your iOS or tvOS app twinkle.

Twinkle โœจ Twinkle is a Swift and easy way to make any UIView in your iOS or tvOS app twinkle. This library creates several CAEmitterLayers and animate

patrick piemonte 600 Nov 24, 2022
Powerful and easy-to-use vector graphics Swift library with SVG support

Macaw Powerful and easy-to-use vector graphics Swift library with SVG support We are a development agency building phenomenal apps. What is Macaw? Mac

Exyte 5.9k Jan 1, 2023
Fashion is your helper to share and reuse UI styles in a Swifty way.

Fashion is your helper to share and reuse UI styles in a Swifty way. The main goal is not to style your native apps in CSS, but use a set

Vadym Markov 124 Nov 20, 2022
Custom emojis are a fun way to bring more life and customizability to your apps.

Custom emojis are a fun way to bring more life and customizability to your apps. They're available in some of the most popular apps, such as Slack, Di

Stream 244 Dec 11, 2022
BulletinBoard is an iOS library that generates and manages contextual cards displayed at the bottom of the screen

BulletinBoard is an iOS library that generates and manages contextual cards displayed at the bottom of the screen. It is especially well

Alexis (Aubry) Akers 5.3k Jan 2, 2023
โšก๏ธ A library of widgets and helpers to build instant-search applications on iOS.

By Algolia. InstantSearch family: InstantSearch iOS | InstantSearch Android | React InstantSearch | InstantSearch.js | Angular InstantSearch | Vue Ins

Algolia 567 Dec 20, 2022
A drop-in universal library helps you to manage the navigation bar styles and makes transition animations smooth between different navigation bar styles

A drop-in universal library helps you to manage the navigation bar styles and makes transition animations smooth between different navigation bar styles while pushing or popping a view controller for all orientations. And you don't need to write any line of code for it, it all happens automatically.

Zhouqi Mo 3.3k Dec 21, 2022
StarryStars is iOS GUI library for displaying and editing ratings

StarryStars StarryStars is iOS GUI library for displaying and editing ratings Features StarryStars' RatingView is both IBDesignable and IBInspectable

Peter Prokop 175 Nov 19, 2022
Wallet is a library to manage cards and passes.

Wallet Wallet is a replica of the Apple's Wallet interface. Add, delete or present your cards and passes. Feel free to use this pod in your project an

Russ St Amant 360 Feb 4, 2022
ScrollViewPlus is a small library that provides some helpful extension and capabilities for working with NSScrollView.

ScrollViewPlus is a small library that provides some helpful extension and capabilities for working with NSScrollView.

Chime 12 Dec 26, 2022