Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ivanbruel/ForceTouchable
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanbruel committed Feb 1, 2016
2 parents 19c965b + 2d215fd commit 0110894
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# ForceTouchable

[![CI Status](http://img.shields.io/travis/Ivan Bruel/ForceTouchable.svg?style=flat)](https://travis-ci.org/Ivan Bruel/ForceTouchable)
[![Version](https://img.shields.io/cocoapods/v/ForceTouchable.svg?style=flat)](http://cocoapods.org/pods/ForceTouchable)
[![License](https://img.shields.io/cocoapods/l/ForceTouchable.svg?style=flat)](http://cocoapods.org/pods/ForceTouchable)
[![Platform](https://img.shields.io/cocoapods/p/ForceTouchable.svg?style=flat)](http://cocoapods.org/pods/ForceTouchable)
Expand All @@ -20,6 +19,31 @@ 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)`.

```swift
// MARK: ForceTouchable
extension ViewController: ForceTouchable {

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]
Expand Down

0 comments on commit 0110894

Please sign in to comment.