Skip to content

Create easy and customizable effects with Swift Haptics

Notifications You must be signed in to change notification settings

josavicente/HapticEngine

Repository files navigation

HapticEngine

Haptic Engine is a wrapper of Core Haptics to make it easier to create haptic taps combinations.

Usage

import HapticEngine

let engine = HapticsEngine()

try? engine.launch(intensity: 0.2, sharpness: 0.8)

Integration with SwiftUI

HapticEngine use Combine powerfull framework with @Environment. Create you own engine and pass as an environment object on root App View. Then, yo can access on any of your views Like that

import SwiftUI
import HapticEngine

@main
struct ExampleApp: App {
    

    let haptics = HapticEngine()
    
    var body: some Scene {
        WindowGroup {
            RuinNavigation()
                .environmentObject(haptics)   
        }
    }
}

import HapticEngine

struct SomeView: View {
    
  
    @EnvironmentObject private var haptics: HapticEngine
    .
    .
    .
    .
    .
}

Installation

SwiftPM

dependencies: [
    .package(url: "https://github.com/josavicente/HapticEngine", from: "0.0.1")
],
targets: [
    .target(name: "YourTarget", dependencies: ["HapticEngine"])
]

About

Create easy and customizable effects with Swift Haptics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages