Repository navigation
Getting Started Guide
#Getting Started with the Jot Touch SDK
##Download the JotTouchSDK
You can download the latest version of the JotTouchSDK from:
https://github.com/Adonit/JotTouchSDK
or you can clone the repository directly with:
$ git clone git@github.com:Adonit/JotTouchSDK.git##Adding the JotTouchSDK to your project After downloading the SDK, copy the included JotTouchSDK.framework into your project’s folder.
Building your app with the Jot Touch SDK
Next, it’s time to link the JotTouchSDK framework to your app. To do that, select your project’s name in the Project Navigator in Xcode (1), then select your app’s target (2), then choose Build Phases from the top bar navigation (3), and finally press the + button to link a new framework to your project (4).

Choose the Add Other button from the framework modal that appears, and then find and select the JotTouchSDK.framework file from the Finder window.

This will add the JotTouchSDK framework to the list of frameworks that your app will link against when it builds.

This will add the JotTouchSDK framework to the list of frameworks that your app will link against when it builds.
The JotTouchSDK also requires two other iOS frameworks: AudioToolbox and CoreBluetooth. Press the + button again, and choose these two frameworks from the list provided by the Xcode framework modal.
After you are done, your project should be linking against at least these 3 frameworks:

Now you’re ready to start using the JotTouchSDK!
##Compile with the JotTouchSDK ###Including the JotTouchSDK To use the JotTouchSDK from any of our project’s source files, simply include the JotStylusManager from the SDK’s folder:
#import <JotTouchSDK/JotStylusManager.h>###Enable the JotTouchSDK Before you can connect to a Jot Touch stylus, you’ll need to explicitly enable the SDK from within your application. By default, the JotTouchSDK is disabled. This call will enable the SDK to listen for stylus connections over Bluetooth.
[[JotStylusManager sharedInstance] setEnabled:YES];To re-disable the SDK after enabling, simply:
[[JotStylusManager sharedInstance] setEnabled:NO];When the JotSDK is disabled, it will never send any calls to the delegates you specify on the JotStylusManager.
###Register Your Drawing UIView In order for the JotTouchSDK to determine which of the touch events belong to a finger or stylus, it needs to intercept the UITouch events on your UIView. To register your view so that the JotTouchSDK can listen to these events, call the registerView: method on the JotStylusManager, as below:
[[JotStylusManager sharedInstance] registerView:yourDrawingView]That’s all that is needed for the JotTouchSDK to start sending stylus events to your delegates.
##Configuring the JotTouchSDK ###Default Pressure Value When the SDK reports a stylus event, it will include the stylus tip pressure value between 0 and 2047. However, when a stylus is not connected to the SDK, you can decide what pressure value that the SDK should report.
[[JotStylusManager sharedInstance] setUnconnectedPressure:1024];This is particularly useful if you are using the pressure value to help determine the width of a pen stroke, for instance. You can set this unconnected pressure value to a reasonable default value for your algorithm. In this way, you can blindly use the pressure data reported by the SDK regardless of a Jot Touch being connected, and be confident that the value will be appropriate for your width algorithm.
###Palm Rejection The JotTouchSDK also optionally provides advanced palm rejection whenever a Jot Touch stylus is connected. To enable palm rejection:
[[JotStylusManager sharedInstance] setRejectMode:YES];When palm rejection is enabled, only events that are known to be Jot Touch stylus events will be reported by the SDK and sent to the palmRejectorDelegate of the JotStylusManager. When palm rejection is disabled, all touch events will be reported as stylus events, and will all share the same pressure value of the connected Jot Touch.
###Configuring the two Jot Touch buttons To set up an action for the buttons, add the following code when your application initializes, usually in your root view controller:
[[JotStylusManager sharedInstance] addShortcutOptionButton1Default: [[JotShortcut alloc]
initWithShortDescription:@"Undo"
key:@"undo"
target:self selector:@selector(undo)
repeatRate:100]];There is a parallel method for the 2nd button beginning with
addShortcutOptionButton2Default:These two methods will set the default button behaviors, and will call the target’s selector each time the button is pressed. The repeatRate determines how often the selector will be called if the user holds down the stylus button.
If using the Jot Touch UI elements, you can also configure additional options that the user can choose for the button behavior. To add user configurable options for the buttons, simply call the method addShortcutOption:.
If the user changes the active shortcut, either through the provided JotSettingsController or otherwise, you can always access the current short.cut through the button1Shortcut and button2Shortcut properties of the JotStylusManager. These properties are readwrite, so you can also set to any JotShortcut.
##Listen for Drawing Events The palmRejectorDelegate property on the JotStylusManager handles all stylus drawing notifications.
The JotTouchSDK categorizes each UITouch on a registered view as either a palm, finger, or stylus. If palm rejection is turned on, then only touch events that match a Jot Touch stylus will be forwarded to the delegate. If palm rejection is turned off in the SDK, then every event is considered a stylus event and will be forwarded to the palmRejectorDelegate.
Many applications may add additional gestures to their drawing UIView, such as a pinch-to-zoom gesture. If the user rests their palm on the screen, these gestures might be triggered accidentally. The JotTouchSDK also notifies the palmRejectorDelegate when any additional gestures should be disabled. This is based on both when the palm is detected as well as when the user is actively drawing with the Jot stylus.
#pragma mark - PalmRejectionDelegate
-(void)jotStylusTouchBegan: (NSSet*) jotTouches{
// a Jot stylus has begun to draw on the screen
}
-(void)jotStylusTouchMoved: (NSSet*) jotTouches{
// a Jot stylus is moving on the screen
}
-(void)jotStylusTouchEnded: (NSSet*) jotTouches{
// a Jot stylus has ended normally on the screen
}
-(void)jotStylusTouchCancelled: (NSSet*) jotTouches{
// a stylus event has been cancelled on the screen
}
-(void)jotSuggestsToDisableGestures{
// the Jot Touch SDK has determined that the user’s palm is likely
// resting on the screen or the user is actively drawing with the
// Jot stylus, and we recommend to disable any other gestures
// that might be attached to that UIView, such as a pinch-to-zoom
// gesture
}
-(void)jotSuggestsToEnableGestures{
// The user’s palm has lifted and drawing has stopped, so it is
// safe to re-enable any other gestures on the UIView
}Jot palm rejection can also be optimized for left vs right handed users. The SDK will default to right handed users, but can be set with the palmRejectionOrientation property on the JotStylusManager.
###Listen for Stylus Connection Events Whenever a Jot Touch stylus connects or disconnects from the SDK, events are sent to the JotStylusManager’s connectionDelegate. To setup a connection delegate, simply set the property on the manager itself:
[[JotStylusManager sharedInstance] setConnectionDelegate:myDelegate];The delegate must conform to the StylusConnectionDelegate protocol:
#pragma mark - StylusConnectionDelegate
-(void)jotStylusConnected: (id <StylusConnection>)conn{
// a Jot Touch stylus has connected to the SDK
}
-(void)jotStylusDisconnected: (id <StylusConnection>)conn{
// a Jot Touch stylus has explicitly disconnected
}
-(void)jotStylusBatteryUpdate:(uint)batteryLevel{
// the Jot battery level has been updated
// values are between 0 and 100. Anything 10 or less means
// the user should recharge the Jot
}##Jot Settings Panel The Jot Touch SDK also provides a default settings panel to let the user easily update their left/right handedness, set their preferred shortcut button behavior, and other options.
To show the settings panel, simply add the JotSettingsViewController to a UIPopoverController:
SettingsViewController* settings = [[SettingsViewController alloc] init];
if(popoverController){
[popoverController dismissPopoverAnimated:NO];
}
popover = [[UIPopoverController alloc] initWithContentViewController:settings];
[popover presentPopoverFromRect:sender.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
[popover setPopoverContentSize:CGSizeMake(300, 400) animated:NO];This will show a panel that will let the user enable or disable the SDK, as well as check the battery level of their Jot and set palm rejection and shortcut button preferences. <<<<<<< HEAD:Getting-Started-Guide.md
Minor changes:GettingStarted.md
Copyright (c) 2021 Adonit. All rights reserved.