Skip to content

AlexChekel1337/TouchIndicators

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TouchIndicators

Unlike Android, iOS does not get an option to show touches, sometimes making it harder to understand which buttons users press to get to the problem, especially with UICollectionView-backed Lists and Forms in SwiftUI.
Here's where TouchIndicators comes to the rescue! It is a small Swift package that enables your app to show touch indicators in screen recordings and screenshots, and is compatible with both UIKit and SwiftUI projects.

Platform badge OS badge Swift badge

Example

Usage

You can enable or disable touch indicators at any moment by updating showsTouches property on UIWindow:

import SwiftUI
import TouchIndicators
import UIKit

@main
struct MyApp: App {
    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }

    init() {
        UIWindow.showsTouches = true
    }
}

In SwiftUI-based projects you also have a binding to easily connect your toggle to the showsTouches property:

Toggle("Show touches", isOn: UIWindow.showsTouchesBinding)

Appearance

Touch indicator appearance can be configured with custom background color, border, or size. Here's how to customize certain properties or create a fully custom configuration:

// Update configuration with custom touch indicator size...
UIWindow.touchIndicatorConfiguration.size = 44

// ...or create a fully custom configuration
let configuration = TouchIndicatorConfiguration(
    size: 44,
    backgroundColor: .red.withAlphaComponent(0.5),
    border: .solid(1, color: .red)
)
UIWindow.touchIndicatorConfiguration = configuration

About

Show touch indicators in your app!

Resources

License

Stars

Watchers

Forks

Languages