Skip to content

Commit f316134

Browse files
authored
Merge pull request #58 from openium/master
Fixes for Swift Package Manager #47
2 parents b9ee2b8 + 58781d0 commit f316134

File tree

8 files changed

+59
-34
lines changed

8 files changed

+59
-34
lines changed

Package.swift

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
1+
// swift-tools-version:5.0
2+
13
import PackageDescription
24

35
let package = Package(
4-
name: "TransitionButton"
6+
name: "TransitionButton",
7+
platforms: [
8+
.iOS(.v8)
9+
],
10+
products: [
11+
.library(
12+
name: "TransitionButton",
13+
targets: ["TransitionButton"]),
14+
],
15+
targets: [
16+
.target(
17+
name: "TransitionButton",
18+
dependencies: []),
19+
]
520
)
File renamed without changes.
File renamed without changes.

Source/TransitionButton.swift renamed to Sources/TransitionButton/TransitionButton.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public enum StopAnimationStyle {
5959

6060
private var cachedTitle: String?
6161
private var cachedImage: UIImage?
62+
private var cachedBounds: CGRect?
6263

6364
private let springGoEase:CAMediaTimingFunction = CAMediaTimingFunction(controlPoints: 0.45, -0.36, 0.44, 0.92)
6465
private let shrinkCurve:CAMediaTimingFunction = CAMediaTimingFunction(name: .linear)
@@ -97,6 +98,7 @@ public enum StopAnimationStyle {
9798
self.isUserInteractionEnabled = false // Disable the user interaction during the animation
9899
self.cachedTitle = title(for: .normal) // cache title before animation of spiner
99100
self.cachedImage = image(for: .normal) // cache image before animation of spiner
101+
self.cachedBounds = bounds // cache bounds before animation of spinner
100102

101103
self.setTitle("", for: .normal) // place an empty string as title to display a spiner
102104
self.setImage(nil, for: .normal) // remove the image, if any, before displaying the spinner
@@ -175,7 +177,7 @@ public enum StopAnimationStyle {
175177
private func animateToOriginalWidth(completion:(()->Void)?) {
176178
let shrinkAnim = CABasicAnimation(keyPath: "bounds.size.width")
177179
shrinkAnim.fromValue = (self.bounds.height)
178-
shrinkAnim.toValue = (self.bounds.width)
180+
shrinkAnim.toValue = (self.cachedBounds?.width ?? self.bounds.width)
179181
shrinkAnim.duration = shrinkDuration
180182
shrinkAnim.timingFunction = shrinkCurve
181183
shrinkAnim.fillMode = .forwards

TransitionButton.xcodeproj/project.pbxproj

Lines changed: 40 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10-
7AF506471F2D086E00631DA4 /* CGRectExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AF506411F2D086E00631DA4 /* CGRectExtension.swift */; };
11-
7AF506481F2D086E00631DA4 /* CustomTransitionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AF506421F2D086E00631DA4 /* CustomTransitionViewController.swift */; };
12-
7AF506491F2D086E00631DA4 /* FadeTransition.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AF506431F2D086E00631DA4 /* FadeTransition.swift */; };
13-
7AF5064B1F2D086E00631DA4 /* SpinerLayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AF506451F2D086E00631DA4 /* SpinerLayer.swift */; };
14-
7AF5064C1F2D086E00631DA4 /* TransitionButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AF506461F2D086E00631DA4 /* TransitionButton.swift */; };
10+
BA95372925665E880037233E /* CustomTransitionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA95372325665E880037233E /* CustomTransitionViewController.swift */; };
11+
BA95372A25665E880037233E /* SpinerLayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA95372425665E880037233E /* SpinerLayer.swift */; };
12+
BA95372B25665E880037233E /* TransitionButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA95372525665E880037233E /* TransitionButton.swift */; };
13+
BA95372C25665E880037233E /* FadeTransition.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA95372625665E880037233E /* FadeTransition.swift */; };
14+
BA95372D25665E880037233E /* CGRectExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA95372725665E880037233E /* CGRectExtension.swift */; };
1515
D93F1CA21EAEDB6E009A7474 /* TransitionButton.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D93F1C981EAEDB6E009A7474 /* TransitionButton.framework */; };
1616
D93F1CA71EAEDB6E009A7474 /* TransitionButtonTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D93F1CA61EAEDB6E009A7474 /* TransitionButtonTests.swift */; };
1717
/* End PBXBuildFile section */
@@ -27,13 +27,13 @@
2727
/* End PBXContainerItemProxy section */
2828

2929
/* Begin PBXFileReference section */
30-
7AF506411F2D086E00631DA4 /* CGRectExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CGRectExtension.swift; sourceTree = "<group>"; };
31-
7AF506421F2D086E00631DA4 /* CustomTransitionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomTransitionViewController.swift; sourceTree = "<group>"; };
32-
7AF506431F2D086E00631DA4 /* FadeTransition.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FadeTransition.swift; sourceTree = "<group>"; };
33-
7AF506451F2D086E00631DA4 /* SpinerLayer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SpinerLayer.swift; sourceTree = "<group>"; };
34-
7AF506461F2D086E00631DA4 /* TransitionButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransitionButton.swift; sourceTree = "<group>"; };
30+
BA95372325665E880037233E /* CustomTransitionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomTransitionViewController.swift; sourceTree = "<group>"; };
31+
BA95372425665E880037233E /* SpinerLayer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SpinerLayer.swift; sourceTree = "<group>"; };
32+
BA95372525665E880037233E /* TransitionButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransitionButton.swift; sourceTree = "<group>"; };
33+
BA95372625665E880037233E /* FadeTransition.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FadeTransition.swift; sourceTree = "<group>"; };
34+
BA95372725665E880037233E /* CGRectExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CGRectExtension.swift; sourceTree = "<group>"; };
35+
BA95372825665E880037233E /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
3536
D93F1C981EAEDB6E009A7474 /* TransitionButton.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = TransitionButton.framework; sourceTree = BUILT_PRODUCTS_DIR; };
36-
D93F1C9C1EAEDB6E009A7474 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
3737
D93F1CA11EAEDB6E009A7474 /* TransitionButtonTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TransitionButtonTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
3838
D93F1CA61EAEDB6E009A7474 /* TransitionButtonTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransitionButtonTests.swift; sourceTree = "<group>"; };
3939
D93F1CA81EAEDB6E009A7474 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -58,10 +58,31 @@
5858
/* End PBXFrameworksBuildPhase section */
5959

6060
/* Begin PBXGroup section */
61+
BA95372125665E880037233E /* Sources */ = {
62+
isa = PBXGroup;
63+
children = (
64+
BA95372225665E880037233E /* TransitionButton */,
65+
);
66+
path = Sources;
67+
sourceTree = "<group>";
68+
};
69+
BA95372225665E880037233E /* TransitionButton */ = {
70+
isa = PBXGroup;
71+
children = (
72+
BA95372325665E880037233E /* CustomTransitionViewController.swift */,
73+
BA95372425665E880037233E /* SpinerLayer.swift */,
74+
BA95372525665E880037233E /* TransitionButton.swift */,
75+
BA95372625665E880037233E /* FadeTransition.swift */,
76+
BA95372725665E880037233E /* CGRectExtension.swift */,
77+
BA95372825665E880037233E /* Info.plist */,
78+
);
79+
path = TransitionButton;
80+
sourceTree = "<group>";
81+
};
6182
D93F1C8E1EAEDB6E009A7474 = {
6283
isa = PBXGroup;
6384
children = (
64-
D93F1C9A1EAEDB6E009A7474 /* Source */,
85+
BA95372125665E880037233E /* Sources */,
6586
D93F1CB41EAEDCD8009A7474 /* Resources */,
6687
D93F1CA51EAEDB6E009A7474 /* Tests */,
6788
D93F1C991EAEDB6E009A7474 /* Products */,
@@ -77,19 +98,6 @@
7798
name = Products;
7899
sourceTree = "<group>";
79100
};
80-
D93F1C9A1EAEDB6E009A7474 /* Source */ = {
81-
isa = PBXGroup;
82-
children = (
83-
7AF506411F2D086E00631DA4 /* CGRectExtension.swift */,
84-
7AF506421F2D086E00631DA4 /* CustomTransitionViewController.swift */,
85-
7AF506431F2D086E00631DA4 /* FadeTransition.swift */,
86-
7AF506451F2D086E00631DA4 /* SpinerLayer.swift */,
87-
7AF506461F2D086E00631DA4 /* TransitionButton.swift */,
88-
D93F1C9C1EAEDB6E009A7474 /* Info.plist */,
89-
);
90-
path = Source;
91-
sourceTree = "<group>";
92-
};
93101
D93F1CA51EAEDB6E009A7474 /* Tests */ = {
94102
isa = PBXGroup;
95103
children = (
@@ -218,11 +226,11 @@
218226
isa = PBXSourcesBuildPhase;
219227
buildActionMask = 2147483647;
220228
files = (
221-
7AF5064C1F2D086E00631DA4 /* TransitionButton.swift in Sources */,
222-
7AF506481F2D086E00631DA4 /* CustomTransitionViewController.swift in Sources */,
223-
7AF506491F2D086E00631DA4 /* FadeTransition.swift in Sources */,
224-
7AF5064B1F2D086E00631DA4 /* SpinerLayer.swift in Sources */,
225-
7AF506471F2D086E00631DA4 /* CGRectExtension.swift in Sources */,
229+
BA95372D25665E880037233E /* CGRectExtension.swift in Sources */,
230+
BA95372B25665E880037233E /* TransitionButton.swift in Sources */,
231+
BA95372A25665E880037233E /* SpinerLayer.swift in Sources */,
232+
BA95372C25665E880037233E /* FadeTransition.swift in Sources */,
233+
BA95372925665E880037233E /* CustomTransitionViewController.swift in Sources */,
226234
);
227235
runOnlyForDeploymentPostprocessing = 0;
228236
};
@@ -377,7 +385,7 @@
377385
DYLIB_COMPATIBILITY_VERSION = 1;
378386
DYLIB_CURRENT_VERSION = 1;
379387
DYLIB_INSTALL_NAME_BASE = "@rpath";
380-
INFOPLIST_FILE = Source/Info.plist;
388+
INFOPLIST_FILE = Sources/TransitionButton/Info.plist;
381389
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
382390
IPHONEOS_DEPLOYMENT_TARGET = 8.3;
383391
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
@@ -402,7 +410,7 @@
402410
DYLIB_COMPATIBILITY_VERSION = 1;
403411
DYLIB_CURRENT_VERSION = 1;
404412
DYLIB_INSTALL_NAME_BASE = "@rpath";
405-
INFOPLIST_FILE = Source/Info.plist;
413+
INFOPLIST_FILE = Sources/TransitionButton/Info.plist;
406414
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
407415
IPHONEOS_DEPLOYMENT_TARGET = 8.3;
408416
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";

0 commit comments

Comments
 (0)