GithubHelp home page GithubHelp logo

adobe-behancemobile / peekpan Goto Github PK

View Code? Open in Web Editor NEW
20.0 6.0 2.0 6.6 MB

PeekPan extends 3D Touch with pan gestures

Home Page: https://www.behance.net/apps

License: Apache License 2.0

Swift 97.86% Objective-C 1.22% Ruby 0.92%
peek-and-pop 3d-touch ios swift ui-components uikit

peekpan's Introduction

PeekPan

PeekPan combines 3D Touch and pan gestures to cycle through a collection of views while Peeking.

It's possible to have a gesture recognizer track the user's touch location while Peeking.
This just provides a way to travel through a range of indices with the mechanics figured out.

The main files used in this library are:

  • PeekPanGestureRecognizer.swift:
    Begins tracking the user's touch location once the Peek preview is displayed and ends once the touch is released.

  • PeekPanCoordinator.swift:
    Correlates the user's touch location to a range of indices within an adjustable panning area.

  • PeekPanViewController.swift:
    A UIViewController used as an optional way to display different UIView on the Peek preview.

##Getting started via CocoaPods

sudo gem install cocoapods

Create a Podfile in your project directory:

pod init

Add the following to your Podfile project's target:

pod 'PeekPan'

Then run CocoaPods with pod install.

Finally, include PeekPanCoordinator.swift, PeekPanGestureRecognizer.swift, and (optional) PeekPanViewController.swift in your project. Make sure to include a bridging header that imports <UIKit/UIGestureRecognizerSubclass.h> for PeekPanGestureRecognizer.swift to build correctly.

The component is targeted for use with iOS 9 but can support iOS 8 and greater.

##How to setup

  1. Initialize PeekPanCoordinator with a view controller's view to add a gesture recognizer and set the bounds of the panning area.

  2. Set the coordinator's data source and have a return value for maximumIndex(for peekPanCoordinator: PeekPanCoordinator) -> Int. Also set the coordinator's delegate and its methods to receive updates.

  3. Call setup() or setup(at: index) in previewingContext(previewingContext:viewControllerForLocation:) to setup the coordinator at a particular index and retreive data from the data source.

  4. Call end(true) in previewingContext(previewingContext:commitViewController:) to change the state of the coordinator and reset its values.


  1. To use PeekPanViewController, setup the coordinator using the directions above and set its delegate to the view controller. Also set the coordinator's data source to a class that follows its protocol.

  2. Return a view to view(for peekPanViewController:atIndex:) -> UIView when there's a change in index or view(for peekPanViewController:atPercentage:) -> UIView when the user's touch location changes. PeekPanViewControllerDelegate is a subclass of PeekPanCoordinatorDelegate so all of the coordinator's delegate methods are available to the view controller's delegate.

####Additional References PeekPan uses some images from Behance made by the following authors licensed under CC BY 4.0:

peekpan's People

Contributors

bchon avatar jverdi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

jverdi itollmous

peekpan's Issues

Sample App

Do you have another sample application of this? Or any other docs that we can look at. I cannot get it to work in our app. We have the delegate method in the VC that we are peeking into and we have set the initializing functions in the main VC but it is crashing the app when we use it. We are definitely doing something wrong but we just don't know what it is. If you have a very basic sample app that shows how it would change the label in a peeked VC, that would be amazing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.