GithubHelp home page GithubHelp logo

xingzhaodev / touchinspector Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jtrivedi/touchinspector

0.0 0.0 0.0 276 KB

TouchInspector is a drop-in package that helps you visualize and debug touches on iOS and iPadOS.

License: MIT License

Swift 100.00%

touchinspector's Introduction

TouchInspector Banner

TouchInspector

TouchInspector is a lightweight package that helps you visualize and debug touches on iOS and iPadOS.

Showing touches is super useful when recording and sharing demos from a device or Simulator.

TouchInspector can optionally also show hit-testing information (i.e. which view a touch is hitting). This is great when trying to identify the type of some view, or debug where a touch is actually going.

Installation

Add TouchInspector to your app's Package.swift file, or selecting File -> Add Packages in Xcode:

.package(url: "https://github.com/jtrivedi/TouchInspector", from: "0.1.0"))

Usage

You'll need to change the type of your application/scene's window to TouchInspectorWindow, which you can do conditionally when developing:

import TouchInspector

func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
    guard let windowScene = (scene as? UIWindowScene) else {
        return
    }
    
    let rootViewController = /* Create your root/initial view controller, 
                                either directly or by extracting from a Storyboard */
    #if DEBUG
    window = TouchInspectorWindow(windowScene: windowScene)
    #else
    window = UIWindow(windowScene: windowScene)
    #endif
    
    window?.rootViewController = rootViewController
    window?.makeKeyAndVisible()
}

Touch and hit-testing visualization is enabled by default when creating a TouchInspectorWindow. You can change that with the following properties:

// Show the touch indicator, but not the hit-testing overlay.
window.showTouches = true
window.showHitTesting = false

touchinspector's People

Contributors

jtrivedi avatar cliss avatar itaybre avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.