Latest 1.0.2
Homepage https://github.com/ivanbruel/ForceTouchable
License MIT
Platforms ios 9.0, requires ARC
Authors

Version
License
Platform

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

ForceTouchable is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "ForceTouchable"

Usage

To use ForceTouchable on your UIViewControllers all you have to do is implement the ForceTouchable protocol.
Most methods are already implemented in case your ForceTouchable implementation is a UIViewController, all you need to implement is forceTouchPreviewForLocation(CGPoint) and call setupForceTouch() on your viewDidAppear method.

// MARK: ForceTouchable
extension ViewController: ForceTouchable {

  override func viewDidAppear(animated: Bool) {
    super.viewDidAppear(animated)
    setupForceTouch()
  }

  func forceTouchPreviewForLocation(location: CGPoint) -> ForceTouchPreview? {
    guard let indexPath = tableView.indexPathForRowAtPoint(location),
      cell = tableView.cellForRowAtIndexPath(indexPath) else { return nil }

    // Create a detail view controller and set its properties.
    guard let detailViewController = storyboard?.instantiateViewControllerWithIdentifier("DetailViewController") as? DetailViewController else { return nil }

    let previewDetail = sampleData[indexPath.row]
    detailViewController.detailItemTitle = previewDetail.title

    return ForceTouchPreview(previewViewController: detailViewController, touchedView: cell)
  }

}

Author

Ivan Bruel, [email protected]

License

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

Latest podspec

{
    "name": "ForceTouchable",
    "version": "1.0.2",
    "summary": "A Force Touch protocol for easy Force Touch integration",
    "description": "A Force Touch protocol for easy Force Touch integration.",
    "homepage": "https://github.com/ivanbruel/ForceTouchable",
    "license": "MIT",
    "authors": {
        "Ivan Bruel": "[email protected]"
    },
    "source": {
        "git": "https://github.com/ivanbruel/ForceTouchable.git",
        "tag": "1.0.2"
    },
    "social_media_url": "https://twitter.com/ivanbruel",
    "platforms": {
        "ios": "9.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*",
    "resource_bundles": {
        "ForceTouchable": [
            "Pod/Assets/*.png"
        ]
    }
}

Pin It on Pinterest

Share This