---
title: "#213: Supporting Peek \u0026 Pop on Older Devices with PeekPop 👓"
url: https://littlebitesofcocoa.com/213-supporting-peek-pop-on-older-devices-with-peekpop
author: Jake Marsh
published: 2016-03-16
topics: ["Libraries","UIKit","3D Touch"]
description: "We've covered 3D Touch quite a bit here, we checked out View Controller Previews with Peek and Pop back in Bite #80."
---

# #213: Supporting Peek & Pop on Older Devices with PeekPop 👓

By Jake Marsh, March 16, 2016. HTML: https://littlebitesofcocoa.com/213-supporting-peek-pop-on-older-devices-with-peekpop

We've covered [3D Touch](https://www.littlebitesofcocoa.com/topics/48-3d-touch?v=l) quite a bit here, we checked out [View Controller Previews](https://littlebitesofcocoa.com/80) with Peek and Pop back in [Bite #80](https://littlebitesofcocoa.com/80).

_Peek/Pop_ are great features, it's a shame only our users with the latest hardware can take advantage of them. Today, we'll check out a brand new library that aims to remedy this. It's from [Roy Marmelstein](https://github.com/marmelroy) and called [PeekPop](https://github.com/marmelroy/PeekPop). Let's dive in.

The basic idea of [PeekPop](https://github.com/marmelroy/PeekPop) is to allow us to support _3D Touch_ <i>style</i> peeking and popping on devices that <i>don't actually have</i> _3D Touch_ hardware 

The **API** is quite similar to UIKit's **built-in** one, let's try it out. 

First, we'll register as a **delegate**, then conform to it:

``` swift
peekPop = PeekPop(viewController: self)
peekPop?.registerForPreviewingWithDelegate(self, sourceView: collectionView!)

func previewingContext(previewingContext: PreviewingContext, viewControllerForLocation location: CGPoint) -> UIViewController? {
  return self.previewControllerForLocation(location)
}

func previewingContext(previewingContext: PreviewingContext, commitViewController viewControllerToCommit: UIViewController) {
  self.navigationController?.pushViewController(viewControllerToCommit, animated: false)
}
```

That's it! Neat.

[PeekPop](https://github.com/marmelroy/PeekPop) will use 3D Touch <i>if available</i>, then fall back on older devices to monitoring signficant changes in a **UITouch's** `majorRadius` **property**. (Pressing harder usually causes this to increase, even on older devices, since often more of the surface area of the finger is in contact with the screen).

More info about <span style='color: #8C5637'>PeekPop</span> can be found at [git.io/peekpop](http://git.io/peekpop)
