diff --git a/README.md b/README.md
index c4e3267b..bc2aacf2 100644
--- a/README.md
+++ b/README.md
@@ -227,4 +227,4 @@ We love to hear about apps that use Shuffle - feel free to submit a pull request
---
-Made with ❤️ by Mac Gallagher
\ No newline at end of file
+Made with ❤️ by Mac Gallagher
diff --git a/Shuffle-iOS.podspec b/Shuffle-iOS.podspec
index e10ffc7e..4eb62a6e 100644
--- a/Shuffle-iOS.podspec
+++ b/Shuffle-iOS.podspec
@@ -13,8 +13,7 @@ s.homepage = "https://github.com/mac-gallagher/Shuffle"
s.documentation_url = "https://github.com/mac-gallagher/Shuffle/tree/master/README.md"
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { "Mac Gallagher" => "jmgallagher36@gmail.com" }
-s.source = { :git => "https://github.com/mac-gallagher/Shuffle.git", :tag => "v0.2.6" }
-
+s.source = { :git => "https://github.com/mac-gallagher/Shuffle.git", :tag => "v0.2.5" }
s.swift_version = "5.0"
s.source_files = "Sources/**/*.{h,swift}"
diff --git a/Shuffle.xcodeproj/project.pbxproj b/Shuffle.xcodeproj/project.pbxproj
index bd494bdc..45d5a83d 100644
--- a/Shuffle.xcodeproj/project.pbxproj
+++ b/Shuffle.xcodeproj/project.pbxproj
@@ -21,6 +21,7 @@
/* End PBXAggregateTarget section */
/* Begin PBXBuildFile section */
+ 65AD978A2481B093008D3A79 /* Axis.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65AD97892481B093008D3A79 /* Axis.swift */; };
387D5E42FEF4A017C5407B1F /* Pods_ShuffleTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AD73382D22D7142EE1082545 /* Pods_ShuffleTests.framework */; };
881FD28C231B78FB003ACA43 /* CardStackAnimationOptionsSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 881FD28B231B78FB003ACA43 /* CardStackAnimationOptionsSpec.swift */; };
904ADE5B4A83DD023287EB73 /* Pods_ShuffleExample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 91AB74E2E12D2E4C970B6743 /* Pods_ShuffleExample.framework */; };
@@ -124,6 +125,7 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
+ 65AD97892481B093008D3A79 /* Axis.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Axis.swift; sourceTree = ""; };
1070E8CB25529479CB067AD3 /* Pods-ShuffleTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ShuffleTests.release.xcconfig"; path = "Target Support Files/Pods-ShuffleTests/Pods-ShuffleTests.release.xcconfig"; sourceTree = ""; };
29C7C2F3D3AC996FDD3FFF70 /* Pods-ShuffleTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ShuffleTests.debug.xcconfig"; path = "Target Support Files/Pods-ShuffleTests/Pods-ShuffleTests.debug.xcconfig"; sourceTree = ""; };
604684987DE74002FE435206 /* Pods-ShuffleExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ShuffleExample.debug.xcconfig"; path = "Target Support Files/Pods-ShuffleExample/Pods-ShuffleExample.debug.xcconfig"; sourceTree = ""; };
@@ -318,6 +320,7 @@
AD18F0DE22B9F874007BACE9 /* Shuffle */ = {
isa = PBXGroup;
children = (
+ 65AD97892481B093008D3A79 /* Axis.swift */,
AD72AC6F2270E6380083E735 /* SwipeDirection.swift */,
AD10982222879C42008CB197 /* SwipeCard */,
ADA444D522AC651B00AFAFFE /* SwipeCardStack */,
@@ -821,6 +824,7 @@
AD52EF8122E5088B0063AE5D /* CardTransformProvider.swift in Sources */,
AD514C5B22A08D5600BD8F3E /* CardLayoutProvider.swift in Sources */,
AD72AC9A2270FCCE0083E735 /* SwipeDirection.swift in Sources */,
+ 65AD978A2481B093008D3A79 /* Axis.swift in Sources */,
ADA444D922AC658E00AFAFFE /* SwipeCardStackDataSource.swift in Sources */,
AD52EF8722E523020063AE5D /* CardStackTransformProvider.swift in Sources */,
ADEE86D722ACE5AA00AAE7A1 /* Array+Extensions.swift in Sources */,
diff --git a/Sources/Shuffle/Axis.swift b/Sources/Shuffle/Axis.swift
new file mode 100644
index 00000000..446b9d07
--- /dev/null
+++ b/Sources/Shuffle/Axis.swift
@@ -0,0 +1,54 @@
+///
+/// MIT License
+///
+/// Copyright (c) 2020 Mac Gallagher
+///
+/// Permission is hereby granted, free of charge, to any person obtaining a copy
+/// of this software and associated documentation files (the "Software"), to deal
+/// in the Software without restriction, including without limitation the rights
+/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+/// copies of the Software, and to permit persons to whom the Software is
+/// furnished to do so, subject to the following conditions:
+///
+/// The above copyright notice and this permission notice shall be included in all
+/// copies or substantial portions of the Software.
+///
+/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+/// SOFTWARE.
+///
+
+import UIKit
+
+/// A type representing the axis of a physical drag animation.
+@objc public enum Axis: Int {
+
+ case vertical, horizontal, all
+
+ /// The `Axis` translation represented as a CGAffineTransform
+ public func translation(_ point: CGPoint) -> CGAffineTransform {
+ switch self {
+ case .vertical:
+ return CGAffineTransform(translationX: 0, y: point.y)
+ case .horizontal:
+ return CGAffineTransform(translationX: point.x, y: 0)
+ case .all:
+ return CGAffineTransform(translationX: point.x, y: point.y)
+ }
+ }
+
+ public var description: String {
+ switch self {
+ case .vertical:
+ return "vertical"
+ case .horizontal:
+ return "horizontal"
+ case .all:
+ return "all"
+ }
+ }
+}
diff --git a/Sources/Shuffle/SwipeCard/CardTransformProvider.swift b/Sources/Shuffle/SwipeCard/CardTransformProvider.swift
index ca79c1c8..b591a7e6 100644
--- a/Sources/Shuffle/SwipeCard/CardTransformProvider.swift
+++ b/Sources/Shuffle/SwipeCard/CardTransformProvider.swift
@@ -61,8 +61,7 @@ class CardTransformProvider: CardTransformProvidable {
func transform(for card: SwipeCard) -> CGAffineTransform {
let dragTranslation = card.panGestureRecognizer.translation(in: card)
- let translation = CGAffineTransform(translationX: dragTranslation.x,
- y: dragTranslation.y)
+ let translation = card.axis.translation(dragTranslation)
let rotation = CGAffineTransform(rotationAngle: rotationAngle(for: card))
return translation.concatenating(rotation)
}
diff --git a/Sources/Shuffle/SwipeCard/SwipeView.swift b/Sources/Shuffle/SwipeCard/SwipeView.swift
index 9024d144..196db027 100644
--- a/Sources/Shuffle/SwipeCard/SwipeView.swift
+++ b/Sources/Shuffle/SwipeCard/SwipeView.swift
@@ -34,6 +34,10 @@ open class SwipeView: UIView {
/// Defaults to `SwipeDirection.allDirections`.
open var swipeDirections = SwipeDirection.allDirections
+ /// The axis to be animate card in all axis. Set this variable to ignore certain axis.
+ /// Defaults to `Axis.all`.
+ open var axis = Axis.all
+
/// The pan gesture recognizer attached to the view.
public var panGestureRecognizer: UIPanGestureRecognizer {
return internalPanGestureRecognizer
diff --git a/Sources/Shuffle/SwipeCardStack/CardStackTransformProvider.swift b/Sources/Shuffle/SwipeCardStack/CardStackTransformProvider.swift
index dc7f9b2d..57cacf28 100644
--- a/Sources/Shuffle/SwipeCardStack/CardStackTransformProvider.swift
+++ b/Sources/Shuffle/SwipeCardStack/CardStackTransformProvider.swift
@@ -45,7 +45,7 @@ class CardStackTransformProvider: CardStackTransformProvidable {
let scaleX = (1 - percentage) * currentScale.x + percentage * nextScale.x
let scaleY = (1 - percentage) * currentScale.y + percentage * nextScale.y
-
+
return CGAffineTransform(scaleX: scaleX, y: scaleY)
}