Platforms to show: All Mac Windows Linux Cross-Platform

NSTouchMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class Cocoa MBS MacBase Plugin 23.5 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
An object representing the location, size, movement, and force of a touch occurring on the screen.

You access touch objects through UIEvent objects passed into responder objects for event handling. A touch object includes accessors for:

  • The view or window in which the touch occurred
  • The location of the touch within the view or window
  • The approximate radius of the touch
  • The force of the touch (on devices that support 3D Touch or Apple Pencil)

A touch object also contains a timestamp indicating when the touch occurred, an integer representing the number of times the user tapped the screen, and the phase of the touch in the form of a constant that describes whether the touch began, moved, or ended, or whether the system canceled the touch.

To learn how to work with swipes, read Handling Swipe and Drag Gestures in Event Handling Guide for UIKit Apps.

A touch object persists throughout a multi-touch sequence. You may store a reference to a touch while handling a multi-touch sequence, as long as you release that reference when the sequence ends. If you need to store information about a touch outside of a multi-touch sequence, copy that information from the touch.

Using NSTouch on macOS and UITouch on iOS.
This is an abstract class. You can't create an instance, but you can get one from various plugin functions.

Touch Types

Constant Value Description
TouchTypeDirect 0 A touch resulting from direct contact with the screen.
TouchTypeIndirect 1 A touch that doesn’t result from contact with the screen. more
TouchTypeIndirectPointer 3 A touch resulting from a button-based, indirect input device that describes the input sequence from button press to button release.
TouchTypePencil 2 A touch from Apple Pencil.
A pencil touch occurs when Apple Pencil interacts with the device’s screen.
TouchTypeStylus 2 A touch from a stylus.

This class has no sub classes.

Some methods using this class:

Some events using this class:

Blog Entries

Xojo Developer Magazine

Release notes

  • Version 24.1
    • Added identify, resting, deviceSize and normalizedPosition properties to NSTouchMBS class.
  • Version 23.5
    • Added NSTouchMBS class for macOS and iOS (using UITouch on iOS).

The items on this page are in the following plugins: MBS MacBase Plugin.

NSTouchBarMBS   -   NSUbiquitousKeyValueStoreMBS

The biggest plugin in space...