Force Touch / Haptic Touch Menu Implementation for iOS

NOVASOLUTIONS.TECHNOLOGY is engaged in the development, support and maintenance of iOS, Android, PWA mobile applications. We have extensive experience and expertise in publishing mobile applications in popular markets like Google Play, App Store, Amazon, AppGallery and others.
Development and support of all types of mobile applications:
Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1 servicesAll 1735 services
Force Touch / Haptic Touch Menu Implementation for iOS
Simple
~1 business day
FAQ
Our competencies:
Development stages
Latest works
  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    756
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    624
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1052
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    947
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    862
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    445

Implementing Force Touch / Haptic Touch Menu for iOS

Force Touch (iPhone 6s–X) and Haptic Touch (iPhone XR and newer) are two different mechanisms, both opening context menu on long press or press with force. Since iOS 13, both technologies are unified through UIContextMenuInteraction — one implementation works on all devices.

UIContextMenuInteraction — The Right Path

UITableView and UICollectionView have built-in support through delegate methods. For arbitrary View:

let interaction = UIContextMenuInteraction(delegate: self)
myView.addInteraction(interaction)

func contextMenuInteraction(
    _ interaction: UIContextMenuInteraction,
    configurationForMenuAtLocation location: CGPoint
) -> UIContextMenuConfiguration? {
    return UIContextMenuConfiguration(identifier: nil, previewProvider: nil) { _ in
        let share = UIAction(title: "Share", image: UIImage(systemName: "square.and.arrow.up")) { _ in
            self.shareItem()
        }
        let delete = UIAction(title: "Delete", image: UIImage(systemName: "trash"),
                              attributes: .destructive) { _ in
            self.deleteItem()
        }
        return UIMenu(title: "", children: [share, delete])
    }
}

attributes: .destructive colors the item in red — standard iOS behavior for destructive actions. previewProvider — optional custom preview on long press, without it iOS shows automatic View screenshot.

For UITableView

func tableView(_ tableView: UITableView,
               contextMenuConfigurationForRowAt indexPath: IndexPath,
               point: CGPoint) -> UIContextMenuConfiguration? {
    let item = items[indexPath.row]
    return UIContextMenuConfiguration(identifier: indexPath as NSIndexPath) { [weak self] in
        // Preview controller
        ItemPreviewViewController(item: item)
    } actionProvider: { _ in
        UIMenu(title: "", children: [
            UIAction(title: "Open") { _ in self?.openItem(item) },
            UIAction(title: "Delete", attributes: .destructive) { _ in self?.deleteItem(item) }
        ])
    }
}

Single implementation, works on both Force Touch and Haptic Touch, and on iPad with trackpad (right mouse button).

Timeline Benchmarks

Implementing context menu via UIContextMenuInteraction or UITableView/UICollectionView delegate methods — within one working day, including testing on devices with Force Touch and Haptic Touch.