Latest 1.0.0
Homepage https://github.com/justeat/JustPeek
License Apache 2.0
Platforms ios 8.3
Frameworks UIKit

JustPeek Banner

Version
License
Platform

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.

JustPeek Demo

Usage

Swift 3.2 = Version 0.3.1

Swift 4 = Version 1.0.0

// In a UITableViewController

import 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.
To install it, simply add the following line to your Podfile:

pod "JustPeek"

License

JustPeek is available under the Apache License, Version 2.0. See the LICENSE file for more info.

Latest podspec

{
    "name": "JustPeek",
    "version": "1.0.0",
    "summary": "iOS Library that adds support for Force Touch-like Peek and Pop interactions on older devices",
    "description": "JustPeek is an iOS Library that adds support for Force Touch-like Peek and Pop interactions on devices that do not natively support it due to lack of force recognition in the screen.nUnder the hood it uses the native implementation if available, otherwise a custom implementation based on UILongPressGestureRecognizer.",
    "homepage": "https://github.com/justeat/JustPeek",
    "license": {
        "type": "Apache 2.0",
        "file": "LICENSE"
    },
    "authors": "Just Eat",
    "source": {
        "git": "https://github.com/justeat/JustPeek.git",
        "tag": "1.0.0"
    },
    "social_media_url": "https://twitter.com/justeat_tech",
    "platforms": {
        "ios": "8.3"
    },
    "source_files": "JustPeek/Classes/**/*",
    "frameworks": "UIKit",
    "pushed_with_swift_version": "4"
}

Pin It on Pinterest

Share This