-
Notifications
You must be signed in to change notification settings - Fork 227
Make rotating of cards customizable #76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Pod::Spec.new do |s| | ||
s.name = "ZLSwipeableViewSwift" | ||
s.version = "0.0.7" | ||
s.version = "0.0.8" | ||
s.summary = "A simple view for building card like interface like Tinder and Potluck." | ||
s.description = <<-DESC | ||
ZLSwipeableViewSwift is a simple view for building card like interface like Tinder and Potluck. | ||
|
@@ -11,9 +11,9 @@ Pod::Spec.new do |s| | |
s.author = { "Zhixuan Lai" => "[email protected]" } | ||
s.social_media_url = "http://twitter.com/ZhixuanLai" | ||
|
||
s.platform = :ios, "8.0" | ||
s.platform = :ios, "9.0" | ||
|
||
s.source = { :git => "https://github.com/zhxnlai/ZLSwipeableViewSwift.git", :tag => "0.0.7" } | ||
s.source = { :git => "https://github.com/zhxnlai/ZLSwipeableViewSwift.git", :tag => "0.0.8" } | ||
s.source_files = "ZLSwipeableViewSwift/*.swift" | ||
|
||
s.framework = "UIKit" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,15 +56,18 @@ class ViewManager : NSObject { | |
private let containerView: UIView | ||
private let miscContainerView: UIView | ||
private let animator: UIDynamicAnimator | ||
private let rotatingSpeedMultiplyer: CGFloat | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should be |
||
|
||
private weak var swipeableView: ZLSwipeableView? | ||
|
||
init(view: UIView, containerView: UIView, index: Int, miscContainerView: UIView, animator: UIDynamicAnimator, swipeableView: ZLSwipeableView) { | ||
init(view: UIView, containerView: UIView, index: Int, miscContainerView: UIView, animator: UIDynamicAnimator, swipeableView: ZLSwipeableView, rotatingSpeedMultiplyer rotMul: CGFloat) { | ||
self.view = view | ||
self.containerView = containerView | ||
self.miscContainerView = miscContainerView | ||
self.animator = animator | ||
self.swipeableView = swipeableView | ||
self.state = ViewManager.defaultSnappingState(view) | ||
self.rotatingSpeedMultiplyer = rotMul | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here as well, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and anywhere else in the file where you've used or defined a variable with that in it's name |
||
|
||
super.init() | ||
|
||
|
@@ -160,13 +163,14 @@ class ViewManager : NSObject { | |
|
||
private func attachView(toPoint point: CGPoint) { | ||
anchorView.center = point | ||
anchorView.backgroundColor = UIColor.blueColor() | ||
anchorView.hidden = true | ||
|
||
|
||
// attach aView to anchorView | ||
let p = view.center | ||
viewToAnchorViewAttachmentBehavior = UIAttachmentBehavior(item: view, offsetFromCenter: UIOffset(horizontal: -(p.x - point.x), vertical: -(p.y - point.y)), attachedToItem: anchorView, offsetFromCenter: UIOffsetZero) | ||
viewToAnchorViewAttachmentBehavior!.length = 0 | ||
let x = (point.x - p.x) * rotatingSpeedMultiplyer + p.x | ||
let y = (point.y - p.y) * rotatingSpeedMultiplyer + p.y | ||
let newPoint = CGPoint(x: x, y: y) | ||
|
||
viewToAnchorViewAttachmentBehavior = UIAttachmentBehavior.pinAttachmentWithItem(view, attachedToItem: anchorView, attachmentAnchor: newPoint) | ||
|
||
// attach anchorView to point | ||
anchorViewToPointAttachmentBehavior = UIAttachmentBehavior(item: anchorView, offsetFromCenter: UIOffsetZero, attachedToAnchor: point) | ||
|
@@ -211,4 +215,4 @@ class ViewManager : NSObject { | |
animator.removeBehavior(behavior) | ||
} | ||
|
||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a reason this change to drop support for iOS 8?