Skip to content

Commit

Permalink
Add Pinchable documentation.
Browse files Browse the repository at this point in the history
Summary: Part of #8

Reviewers: O4 Material Motion Apple platform reviewers, O2 Material Motion, markwei

Reviewed By: O4 Material Motion Apple platform reviewers, O2 Material Motion, markwei

Tags: #material_motion

Differential Revision: http://codereview.cc/D1820
  • Loading branch information
Jeff Verkoeyen committed Nov 1, 2016
1 parent 3ebcb24 commit 19a1214
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/Pinchable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,30 @@ import UIKit
import MaterialMotionRuntime

/**
A plan that enables a target to be scaled by pinching.
Adds the scale delta from a pinch gesture recognizer to the target transform's scale using
multiplication.

Supported target types: UIView.

Enables isUserInteractionEnabled on the target view.
*/
@objc(MDMPinchable)
public final class Pinchable: NSObject, Plan {
/** The gesture recognizer whose events will be observed. */
public let pinchGestureRecognizer: UIPinchGestureRecognizer

/**
Whether or not the target's anchorPoint should be modified each time the gesture
recognizer begins.
*/
public var shouldAdjustAnchorPointOnGestureStart = true

/** Creates a plan with a new pinch gesture recognizer. */
public convenience override init() {
self.init(withGestureRecognizer: UIPinchGestureRecognizer())
}

/** Events generated by the provided gesture recognizer will be observed. */
public init(withGestureRecognizer recognizer: UIPinchGestureRecognizer) {
self.pinchGestureRecognizer = recognizer
super.init()
Expand Down

0 comments on commit 19a1214

Please sign in to comment.