Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/justeat/JustPeek
JustPeek is an iOS Library that adds support for Force Touch-like Peek and Pop interactions on devices that do not natively support this kind of interaction.
https://github.com/justeat/JustPeek
force-touch peek pop-interactions
Last synced: about 1 month ago
JSON representation
JustPeek is an iOS Library that adds support for Force Touch-like Peek and Pop interactions on devices that do not natively support this kind of interaction.
- Host: GitHub
- URL: https://github.com/justeat/JustPeek
- Owner: justeat
- License: apache-2.0
- Archived: true
- Created: 2016-08-05T14:33:48.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-12-12T13:57:12.000Z (about 7 years ago)
- Last Synced: 2024-11-11T03:17:40.778Z (2 months ago)
- Topics: force-touch, peek, pop-interactions
- Language: Shell
- Homepage: http://www.just-eat.com/
- Size: 1.38 MB
- Stars: 68
- Watchers: 28
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ios - JustPeek - JustPeek is an iOS Library that adds support for Force Touch-like Peek and Pop interactions on devices that do not natively support this kind of interaction. (Hardware / Force Touch)
- awesome-ios-star - JustPeek - JustPeek is an iOS Library that adds support for Force Touch-like Peek and Pop interactions on devices that do not natively support this kind of interaction. (Hardware / Force Touch)
README
# JustPeek
[![Version](https://img.shields.io/cocoapods/v/JustPeek.svg?style=flat)](http://cocoapods.org/pods/JustPeek)
[![License](https://img.shields.io/cocoapods/l/JustPeek.svg?style=flat)](http://cocoapods.org/pods/JustPeek)
[![Platform](https://img.shields.io/cocoapods/p/JustPeek.svg?style=flat)](http://cocoapods.org/pods/JustPeek)### Warning: This library is not supported anymore by Just Eat.
JustPeek is an iOS Library that adds support for Force Touch-like Peek and Pop interactions on devices that do not natively support this kind of interaction. Under the hood it uses the native implementation if available, otherwise a custom implementation based on `UILongPressGestureRecognizer`.
## Usage
**Swift 3.2 = Version 0.3.1**
**Swift 4 = Version 1.0.0**
```swift
// In a UITableViewControllerimport JustPeek
...
var peekController: PeekController?
// MARK: View Lifecycle
override func viewDidLoad() {
super.viewDidLoad()
peekController = PeekController()
peekController?.register(viewController: self, forPeekingWithDelegate: self, sourceView: tableView)
}// MARK: PeekingDelegate
func peekContext(_ context: PeekContext, viewControllerForPeekingAt location: CGPoint) -> UIViewController? {
let viewController = storyboard?.instantiateViewController(withIdentifier: "ViewController")
if let viewController = viewController, let indexPath = tableView.indexPathForRow(at: location) {
configureViewController(viewController, withItemAtIndexPath: indexPath)
if let cell = tableView.cellForRow(at: indexPath) {
context.sourceRect = cell.frame
}
return viewController
}
return nil
}func peekContext(_ context: PeekContext, commit viewController: UIViewController) {
show(viewController, sender: self)
}
```## Example
To run the example project, clone the repo, and run `pod install` from the Example directory first.
## Installation
JustPeek is available through [CocoaPods](http://cocoapods.org).
To install it, simply add the following line to your Podfile:```ruby
pod "JustPeek"
```## License
JustPeek is available under the Apache License, Version 2.0. See the LICENSE file for more info.