Skip to content

Lightweight Swift package for triggering haptic feedback on iOS and watchOS. Simple API with predefined feedback types and SwiftUI support. Perfect for adding subtle, tactile interactions to your apps.

Notifications You must be signed in to change notification settings

ceviixx/HapticsKit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HapticsKit

Simple and expressive haptic feedback manager for iOS and watchOS using Swift.

✨ Features

  • Trigger system haptic feedback with a clean Swift API
  • Predefined shortcut methods for common feedback types
  • Works with Button, Text, or any SwiftUI view
  • Supports iOS 13+ and watchOS 6+
  • Includes a SwiftUI ViewModifier for one-liner usage

📦 Installation

Swift Package Manager

In Xcode:

  1. Go to File > Add Packages
  2. Enter the repository URL: https://github.com/ceviixx/HapticsKit.git
  3. Add the HapticsKit library to your target.

🔧 Usage

Trigger feedback manually

import HapticsKit

HapticsManager.success()
HapticsManager.selectionChanged()
HapticsManager.trigger(.impact(style: .medium))


## Use in SwiftUI with ViewModifier
```swift
import SwiftUI
import HapticsKit

Text("Tap me")
    .padding()
    .background(Color.gray.opacity(0.2))
    .cornerRadius(8)
    .hapticFeedback(.selection)

🎛 Available Feedback Types

Manual

HapticsManager.trigger(.selection)
HapticsManager.trigger(.impact(style: .light))
HapticsManager.trigger(.notification(type: .success))

Shortcuts

HapticsManager.selectionChanged()
HapticsManager.lightImpact()
HapticsManager.mediumImpact()
HapticsManager.heavyImpact()
HapticsManager.success()
HapticsManager.error()
HapticsManager.warning()

🛠 Requirements

  • iOS 13+ or watchOS 6+
  • Swift 5.9+
  • Xcode 15+

About

Lightweight Swift package for triggering haptic feedback on iOS and watchOS. Simple API with predefined feedback types and SwiftUI support. Perfect for adding subtle, tactile interactions to your apps.

Topics

Resources

Stars

Watchers

Forks

Languages