KnockToReact is an iOS library written in Swift and Objective-C that brings an exclusive feature to interact with users just by receiving and recognizing "knocks" in the device.

Related tags

Miscellaneous Knock
Overview

UNDER CONSTRUCTION

KnockToReact

KnockToReact is an iOS library written in Swift and Objective-C that brings an exclusive feature to interact with users just by receiving and recognizing "knocks" in the device.

Available for iOS 8.0 and higher.

IMPORTANT: This project uses background tasks that is not guaranteed to be accepted by Apple in the app submission process.

About

It is an example that shows how to use background tasks to receive accelerometer data and recognize patterns to trigger events in the app when the user "knocks" the phone. To make it work you have to let the Knock app on background and knock the device three times calmly. If everything works properly you will receive a local notification with your current coordinates.

You can adjust the knock resistance inside app to find the perfect sensibility in your device.

Knock pattern recognition is optimized to capture knocks when the device is in your pocket or on a soft surface like a bed or a sofa

Once using background tasks, it is not guaranteed that the task will keep running after a few minutes (you can increase this running time by adding background modes such as Location Update).

How to install

Swift

Drag and drop the KnockToReact.swift file to your project

Objective-C

Drag and drop both KnockHelper.h and KnockHelper.m file to your project

How to use

Swift
class ViewController: UIViewController,KnockHelperProtocol {

  override func viewDidLoad() {
    super.viewDidLoad()
    
    let knock = KnockToReact()
    
    knock.delegate = self
    knock.startMotion()
    knock.decrementLimitDifference(10)

  }

  func knockPerformed() {
    print("knock")
  }
}
Objective-C

In your .h file:

@end">
#import <UIKit/UIKit.h>
#import "SingletonLocation.h"
#import "KnockHelper.h"

@interface ViewController : UIViewController 


   @end
  

In your .m file:

- (void)viewDidLoad {
  [super viewDidLoad];
  // Do any additional setup after loading the view, typically from a nib.
  
  [SingletonLocation sharedInstance];
  [KnockHelper sharedInstance].delegate = self;
}

#pragma mark - KnockHelperDelegate

- (void)knockPerformed {
  UILocalNotification *notification = [[UILocalNotification alloc]init];
  NSString *message = [NSString stringWithFormat: @"Latitude: %f - Longitude: %f", [SingletonLocation sharedInstance].currentLocation.coordinate.latitude, [SingletonLocation sharedInstance].currentLocation.coordinate.longitude];
  [notification setAlertBody:message];
  [notification setSoundName:UILocalNotificationDefaultSoundName];
  [[UIApplication sharedApplication]  setScheduledLocalNotifications:[NSArray arrayWithObject:notification]];
}

License

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

You might also like...
Pendo captures product usage data, gathers user feedback, and lets you communicate in-app to onboard, educate, and guide users to value

Pendo SDK for IOS The Pendo Mobile SDK is a code-less, retro-active analytics collector across all of your app's versions. The SDK also allows present

This project is an application that lets users learn about the missions and astronauts that formed NASA’s Apollo space program.

This project is an application that lets users learn about the missions and astronauts that formed NASA’s Apollo space program.

SharedImages Screen grabs Main Features Private & self-owned social media Users store their images in their own cloud storage (Dropbox or Google Drive

SharedImages Screen grabs Main Features Private & self-owned social media Users store their images in their own cloud storage (Dropbox or Google Drive

A starter project for Sample Project in Objective C.

A starter project for Sample Project in Objective C.

Cross-platform instrumentation and introspection library written in C

Gum Cross-platform instrumentation and introspection library written in C. This library is consumed by frida-core through its JavaScript bindings, Gum

iOS's Stocks App clone written in React Native for demo purpose (available both iOS and Android).
iOS's Stocks App clone written in React Native for demo purpose (available both iOS and Android).

FinanceReactNative iOS's Stocks App clone written in React Native for demo purpose (available both iOS and Android). Data is pulled from Yahoo Finance

Delightful code generation for OpenAPI specs for Swift written in Swift
Delightful code generation for OpenAPI specs for Swift written in Swift

Create API Delightful code generation for OpenAPI specs for Swift written in Swi

AuroraEditor is a IDE built by the community, for the community, and written in Swift for the best native performance and feel for macOS.
AuroraEditor is a IDE built by the community, for the community, and written in Swift for the best native performance and feel for macOS.

AuroraEditor AuroraEditor is a IDE built by the community, for the community, and written in Swift for the best native performance and feel for macOS.

The Bitwarden mobile application is written in C# with Xamarin Android, Xamarin iOS, and Xamarin Forms.
The Bitwarden mobile application is written in C# with Xamarin Android, Xamarin iOS, and Xamarin Forms.

Bitwarden Mobile Application The Bitwarden mobile application is written in C# with Xamarin Android, Xamarin iOS, and Xamarin Forms. Build/Run Require

Comments
  • Tasks and ideas

    Tasks and ideas

    Hey @lfarah, as soon as I've set you as a collaborator, I would be very happy if you could give me your opinion about some topics:

    • Customizable options:
      • [x] Number of "knocks" to trigger event.
      • [x] Minimum and maximum time interval allowed between "knocks" to trigger a single event.
      • [x] Time interval allowed between "knock events".
      • [x] "Z" variation needed to recognize a knock (Considering cartesian coordinates (X, Y and Z ) and accelerometer data, the Z variation is related to the oscillation of the phone when the user "knocks" it).
    • General ideas and tasks:
      • [x] Create lincese and the CocoaPod.
      • [x] Use the existent app as an example of the library when it's finished and the pod is created.
      • [x] Change name from "Knock-to-React" to KnockToReact
      • [x] Add Gif showing how it works

    Please, feel free to give me your ideas about the list above and about every other topic. And again, thank you for helping me with this small project (it is really important to me). :smile:

    opened by MatheusCavalca 3
  • Customization

    Customization

    • Number of "knocks" to trigger event.
    • Minimum and maximum time interval allowed between "knocks" to trigger a single event.
    • Time interval allowed between "knock events".
    • "Z" variation needed to recognize a knock (Considering cartesian coordinates (X, Y and Z ) and accelerometer data, the Z variation is related to the oscillation of the phone when the user "knocks" it).

    We'll have to create separate issues later, but for right now, let's keep them organized here

    opened by lfarah 2
  • Updating code and corresponding Readme

    Updating code and corresponding Readme

    I've just tried to implement the swift version on Xcode 9. But can't get this to work. Since I don't fully understand the code I am not certain where exactly is the issue

    I'm getting a few errors on the swift file right off the bat and most can be fixed with Xcode's autosuggestions however I believe it's fixes are messing with how this is supposed to work.

    In addition to that, the instructions in the read me don't seem to be up to date with the KnockToReact.swift file code as far as I can tell. I am getting these errors:

    for class ViewController: UIViewController, KnockHelperProtocol { i am getting: Use of undeclared type 'KnockHelperProtocol'. I assume this is now KnockToReactDelegate?

    for let knock = KnockToReact() i am getting: 'KnockToReact' initializer is inaccessible due to 'private' protection level

    And i think `knockPerformed()' has changed to knockEventPerformed ?

    With any changes I make to resolve the errors I have not been able to get a knock active. Would love help on this if at all possible. Thanks in advance.

    opened by jaymutzafi 0
  • Update README.md

    Update README.md

    The Readme.md should show:

    • [ ] how to install via CocoaPods
    • [x] how to install by dragging and dropping the KnockToReact.swift
    • [x] how to implement the main functionality
    • [ ] how to customize
    • [x] License
    opened by lfarah 4
Owner
Matheus Cavalca
 iOS Software Engineer | WWDC15 Scholar
Matheus Cavalca
Alfred Workflow to be used with Wooshy, that brings any macOS windows to the foreground

Wooshy: Window to the Foreground! Switch apps with Alfred. Switch app windows with Wooshy: Window to the Foreground! ScreenFlow.mp4 Why Aren't you ann

G. 31 Dec 12, 2022
Swift SDK to interact with the Flow Blockchain

Flow Swift SDK The Flow Swift SDK is a Swift gRPC client for Flow. Currently the following Flow Access API methods have been

Ryan Kopinsky 5 Jun 15, 2022
🚀 Create, maintain, and interact with Xcode projects at scale

What's Tuist ?? Tuist is a command line tool that helps you generate, maintain and interact with Xcode projects. It's open source and written in Swift

Tuist 3.1k Jan 6, 2023
AppStoreConnect - Interact with AppStoreConnect

App Store Connect Interact with App Store Connect APIs let client = Client(

Khoa 43 Oct 8, 2022
Distributed actors transport example, for feature review

swift-sample-distributed-actors-transport Sample application and ActorTransport, associated with distributed actor language evolution proposal. Runnin

Apple 84 Jan 2, 2023
Easy quiz just for reviewing structures and MVC

Quizzler Our Goal The goal of this tutorial is to take you one step further in your journey of becoming an app developer. We are going to introduce yo

null 1 May 3, 2022
A simple program to fix doubled key presses on macOS using just software

Untap A simple program to fix doubled key presses on macOS using just software. Installation Download this GitHub repo, cd to its folder in Terminal,

BlueCannonBall 1 May 30, 2022
An iOS app that leverages the device camera and AVKit to calculate brightness.

Libre Light Sensor Privacy Policy Libre Light Sensor An iOS app that leverages the device camera and AVKit to calculate brightness. This app requires

John Harrington 3 Dec 29, 2022
Owl is a portable Wayland compositor written in Objective-C, using Cocoa as its backend.

Owl is a portable Wayland compositor written in Objective-C, using Cocoa as its backend. Owl primarily targets Mac OS X, but also supports a varie

Owl compositor 62 Dec 31, 2022
A common use case is wanting to convert device identifiers such as iPhone10,1 to a user friendly name; iPhone 8.

Devices Swift package that contains all devices from https://www.theiphonewiki.com/wiki/Models. A common use case is wanting to convert device identif

null 17 Nov 28, 2022