Giter Club home page Giter Club logo

vifra's Introduction

Vifra

Build Status codebeat badge codecov Maintainability Docs license

Version Open Source Helpers platform Twitter

Ethereum Litecoin

Vifra is a framework for macOS, iOS and watchOS that provides simplified access to the device actuator to provide haptic feedback (vibration through the taptic engine).

Requirements

  • Swift >= 4
  • macOS >= 10.12
  • watchOS >= 2.0

Installation

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler. It is in early development, but Vifra does support its use on supported platforms.

Once you have your Swift package set up, adding Vifra as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
    .package(url: "https://github.com/matis-schotte/Vifra.git", from: "0.4.0")
]

Do not forget to ensure that the deployment target is set to the correct version (e.g. macOS 10.12), and that all necessary Frameworks are linked (e.g. MultitouchSupport.framework). To avoid getting "undefined symbols" the Bridging header should be used. Possible build command could be:

$ swift build -Xswiftc "-target" -Xswiftc "x86_64-apple-macosx10.12" -Xswiftc "-import-objc-header" -Xswiftc ".build/checkouts/Vifra.git-6919244937016367571/Vifra/Vifra-Bridging-Header.h" -Xlinker -F/System/Library/PrivateFrameworks -Xlinker -lMultitouchSupport && swift run

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate Vifra into your Xcode project using Carthage, specify it in your Cartfile:

github "matis-schotte/Vifra" ~> 0.4

Run carthage update to build the framework and drag the built Vifra.framework into your Xcode project.

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate Vifra into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'Vifra'

Then, run the following command:

$ pod install

Manually

If you prefer not to use any of the aforementioned dependency managers, you can integrate Vifra into your project manually.

  • Open up Terminal, cd into your top-level project directory, and run the following command "if" your project is not initialized as a git repository:
$ git init
  • Add Vifra as a git submodule by running the following command:
$ git submodule add https://github.com/matis-schotte/Vifra.git
  • Open the new Vifra folder, and drag the Vifra.xcodeproj into the Project Navigator of your application's Xcode project.
  • Select the Vifra.xcodeproj in the Project Navigator and verify the deployment target matches that of your application target.
  • Next, select your application project in the Project Navigator (blue project icon) to navigate to the target configuration window and select the application target under the "Targets" heading in the sidebar.
  • In the tab bar at the top of that window, open the "General" panel.
  • Click on the + button under the "Embedded Binaries" section.
  • You will see the Vifra.framework somewhere, just select the correct version.
  • And that's it, try import Vifra!

Usage

You can issue haptic feedback with just any of the following lines using any of the predefined enum values:

Vifra.feedback(.strong)
Vifra.feedback([.strong, .weak, .delay(usec: 500_000), .strong])

Know problems

  • macOS: A private framework is used; it is therefore unlikely to be accepted in the app store.
  • macOS: You cannot enable the sandboxing entitlement; if you do you'll encounter the error -536870174 during Vifra.setup() which is internally being called from Vifra.feedback().

ToDo

  • Add Carthage support
  • Add iOS support (UIFeedbackGenerator and AudioServicesPlaySystemSound(kSystemSoundID_Vibrate))
  • Update macOS support (NSHapticFeedbackPerformer)

License

Vifra is available under the MIT license. See the LICENSE file for more info.

Author

Matis Schotte, [email protected]

https://github.com/matis-schotte/Vifra

vifra's People

Contributors

matis-schotte avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

jtay9562

vifra's Issues

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.