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

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
Stub your network requests easily! Test your apps with fake network data and custom response time, response code and headers!

OHHTTPStubs OHHTTPStubs is a library designed to stub your network requests very easily. It can help you: test your apps with fake network data (stubb

Olivier Halligon 4.9k Dec 29, 2022
A simple and lightweight matching library for XCTest framework.

Match A simple and lightweight matching library for XCTest framework. Getting started Swift Package Manager You can add Match to your project by addin

Michał Tynior 6 Oct 23, 2022
Mock Alamofire and URLSession requests without touching your code implementation

Mocker is a library written in Swift which makes it possible to mock data requests using a custom URLProtocol. Features Requirements Usage Activating

WeTransfer 898 Dec 26, 2022
Automatic testing of your Pull Requests on GitHub and BitBucket using Xcode Server. Keep your team productive and safe. Get up and running in minutes. @buildasaur

Buildasaur Automatic testing of your Pull Requests on GitHub and BitBucket using Xcode Server. Keep your team productive and safe. Get up and running

Buildasaurs 774 Dec 11, 2022
PinpointKit is an open-source iOS library in Swift that lets your testers and users send feedback with annotated screenshots using a simple gesture.

PinpointKit is an open-source iOS library in Swift that lets your testers and users send feedback with annotated screenshots using a simple gesture. F

Lickability 1.1k Jan 6, 2023
This repository accompanies Test-Driven Development in Swift: Compile Better Code with XCTest and TDD

Apress Source Code This repository accompanies Test-Driven Development in Swift: Compile Better Code with XCTest and TDD by Gio Lodi (Apress, 2021). D

Apress 57 Jan 1, 2023
Freezer is a library that allows your Swift tests to travel through time by mocking NSDate class.

Freezer Freezer is a library that allows your Swift tests to travel through time by mocking NSDate class. Usage Once Freezer.start() has been invoked,

Sergey Petrov 8 Sep 24, 2022
Take home task from one company developed on VIPER, UI Through code and splash from plist

HelloFresh Dev Team - Mobile iOS Developer Test Hello! Thank you for taking the time to try our iOS test. The goal of the test is to assess your codin

Jawad Ali 4 Aug 13, 2022
TestSchedulerDemo - Demonstration code for iOS Unit Tests and Asynchronous

TestSchedulerDemo This repository contains demonstration code for my Medium arti

Carsten Wenderdel 0 Mar 19, 2022
Detailed explanations and implementations of various maths concepts for writing high performance code/algorithms backed with Unit tests.

Detailed explanations and implementations of various maths concepts which can help software Engineers write high performance code/algorithms backed with Unit tests.

Mussa Charles 2 Sep 25, 2022
Small library to easily run your tests directly within a Playground

[] (https://developer.apple.com/swift/) Build Status Branch Status master develop About PlaygroundTDD enables you to use TDD directly on Xcode Playgro

Whiskerz AB 317 Nov 22, 2022
This repo holds the code for Dubizzle & Bayut test App

DubizzleClassified This repo holds the code for Dubizzle & Bayut test App About App This is a simple app which basically fetches item list from the gi

Ghassan 0 Jun 2, 2022
Code coverage for Xcode projects (Objective-C only)

XcodeCoverage provides a simple way to generate reports of the Objective-C code coverage of your Xcode project. Generated reports include HTML and Cob

Jon Reid 854 Dec 19, 2022
View your app on different device and font sizes

Sizes reduces the time it takes to evaluate all of our apps possible device sizes, orientations and font combinations. With Sizes we'll avoid launchin

Marcos Griselli 1.2k Oct 27, 2022
Switchboard - easy and super light weight A/B testing for your mobile iPhone or android app. This mobile A/B testing framework allows you with minimal servers to run large amounts of mobile users.

Switchboard - easy A/B testing for your mobile app What it does Switchboard is a simple way to remote control your mobile application even after you'v

Keepsafe 287 Nov 19, 2022
AutoMocker is a Swift framework that leverages the type system to let you easily create mocked instances of your data types.

AutoMocker Context AutoMocker is a Swift framework that leverages the type system to let you easily create mocked instances of your data types. Here's

Vincent Pradeilles 39 May 19, 2022
A Mac and iOS Playgrounds Unit Testing library based on Nimble.

Spry Spry is a Swift Playgrounds Unit Testing library based on Nimble. The best thing about Spry is that the API matches Nimble perfectly. Which means

Quick 327 Jul 24, 2022
UITest helper library for creating readable and maintainable tests

UITestHelper General information When creating UI tests you will see that you are often repeating the same pieces of code. The UITestHelper library wi

Edwin Vermeer 56 Feb 20, 2022
This is a Swift port of Ruby's Faker library that generates fake data.

This is a Swift port of Ruby's Faker library that generates fake data. Are you still bothered with meaningless randomly character strings? Just relax

Vadym Markov 1.6k Jan 3, 2023