Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
josavicente committed Sep 18, 2020
1 parent 570216c commit ef0be5f
Showing 1 changed file with 57 additions and 1 deletion.
58 changes: 57 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,61 @@
# HapticEngine

HapticEngine prives a class to make easy for developers create haptics effects on SwiftUI.
Haptic Engine is a wrapper of [`Core Haptics`](https://developer.apple.com/documentation/corehaptics) to make it easier to create haptic taps combinations.

## Usage

```swift
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

```swift
import SwiftUI
import HapticEngine

@main
struct ExampleApp: App {


let haptics = HapticsEngine()

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

struct SomeView: View {


@EnvironmentObject private var haptics: HapticsEngine
.
.
.
.
.
}
```
## Installation

#### SwiftPM

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

0 comments on commit ef0be5f

Please sign in to comment.