Skip to content

Commit

Permalink
Demo app fixes (#182)
Browse files Browse the repository at this point in the history
- Fix swipe action (second file wasn't included in project)
- Fix showing label about GIF info
- Include third test GIF in demo as well (why not?)
  • Loading branch information
robinst authored Aug 29, 2022
1 parent 15512c4 commit 467eee5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
11 changes: 5 additions & 6 deletions Demo/Demo-iOS/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@ class ViewController: UIViewController {
}

@IBAction func swapImage(_ sender: AnyObject) {
switch currentGIFName {
case "mugen":
currentGIFName = "earth"
default:
currentGIFName = "mugen"
let gifs = ["mugen", "earth", "nailed"]
if let index = gifs.firstIndex(of: currentGIFName) {
let nextIndex = (index + 1) % gifs.count
currentGIFName = gifs[nextIndex]
}
}

Expand All @@ -40,7 +39,7 @@ class ViewController: UIViewController {
}

func animate() {
imageView.animate(withGIFNamed: currentGIFName, animationBlock: {
imageView.animate(withGIFNamed: currentGIFName, preparationBlock: {
DispatchQueue.main.async {
self.imageDataLabel.text = self.currentGIFName.capitalized + " (\(self.imageView.frameCount) frames / \(String(format: "%.2f", self.imageView.gifLoopDuration))s)"
}
Expand Down
8 changes: 8 additions & 0 deletions Demo/Demo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
9D98823F19BC69CA00B790C6 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D98823E19BC69CA00B790C6 /* ViewController.swift */; };
9D98824419BC69CA00B790C6 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9D98824319BC69CA00B790C6 /* Images.xcassets */; };
9D98825A19BC69F600B790C6 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9D98825919BC69F600B790C6 /* Main.storyboard */; };
A5D726E828B53C0800821347 /* earth.gif in Resources */ = {isa = PBXBuildFile; fileRef = A5D726E728B53C0800821347 /* earth.gif */; };
A5D726EC28B5599A00821347 /* nailed.gif in Resources */ = {isa = PBXBuildFile; fileRef = A5D726EB28B5599A00821347 /* nailed.gif */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand Down Expand Up @@ -59,6 +61,8 @@
9D98823E19BC69CA00B790C6 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
9D98824319BC69CA00B790C6 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
9D98825919BC69F600B790C6 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = "<group>"; };
A5D726E728B53C0800821347 /* earth.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; name = earth.gif; path = ../Tests/Images/earth.gif; sourceTree = SOURCE_ROOT; };
A5D726EB28B5599A00821347 /* nailed.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; name = nailed.gif; path = ../Tests/Images/nailed.gif; sourceTree = SOURCE_ROOT; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -149,7 +153,9 @@
9D98823A19BC69CA00B790C6 /* Supporting Files */ = {
isa = PBXGroup;
children = (
A5D726E728B53C0800821347 /* earth.gif */,
002A1BFB1D1624D0005ABBD0 /* mugen.gif */,
A5D726EB28B5599A00821347 /* nailed.gif */,
);
path = "Supporting Files";
sourceTree = "<group>";
Expand Down Expand Up @@ -250,6 +256,8 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
A5D726E828B53C0800821347 /* earth.gif in Resources */,
A5D726EC28B5599A00821347 /* nailed.gif in Resources */,
9D98824419BC69CA00B790C6 /* Images.xcassets in Resources */,
002A1BFC1D1624D0005ABBD0 /* mugen.gif in Resources */,
0032FE841FFA693500444203 /* LaunchScreen.storyboard in Resources */,
Expand Down
4 changes: 4 additions & 0 deletions Gifu.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
00B8C7961A3650EE00C188E7 /* Gifu.h in Headers */ = {isa = PBXBuildFile; fileRef = 00B8C7951A3650EE00C188E7 /* Gifu.h */; settings = {ATTRIBUTES = (Public, ); }; };
00BF42CC1D99A1DC00C6F28D /* GIFAnimatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00BF42CB1D99A1DC00C6F28D /* GIFAnimatable.swift */; };
00DD26EE1DA9643800A0F683 /* UIImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00DD26ED1DA9643800A0F683 /* UIImageView.swift */; };
A5D726EA28B53D6400821347 /* earth.gif in Resources */ = {isa = PBXBuildFile; fileRef = A5D726E928B53D6400821347 /* earth.gif */; };
EAF49C7F1A3A4DE000B395DF /* UIImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF49C7E1A3A4DE000B395DF /* UIImage.swift */; };
EAF49CB11A3B6EEB00B395DF /* AnimatedFrame.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF49CB01A3B6EEB00B395DF /* AnimatedFrame.swift */; };
/* End PBXBuildFile section */
Expand Down Expand Up @@ -52,6 +53,7 @@
00BF42CB1D99A1DC00C6F28D /* GIFAnimatable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GIFAnimatable.swift; sourceTree = "<group>"; };
00C50CFB2392BA9900CBE23C /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
00DD26ED1DA9643800A0F683 /* UIImageView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIImageView.swift; sourceTree = "<group>"; };
A5D726E928B53D6400821347 /* earth.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = earth.gif; sourceTree = "<group>"; };
EAF49C7E1A3A4DE000B395DF /* UIImage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIImage.swift; sourceTree = "<group>"; };
EAF49CB01A3B6EEB00B395DF /* AnimatedFrame.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnimatedFrame.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
Expand Down Expand Up @@ -88,6 +90,7 @@
0036ABBA1BBD1D1700C6CC3D /* Images */ = {
isa = PBXGroup;
children = (
A5D726E928B53D6400821347 /* earth.gif */,
0036ABB61BBD1D0B00C6CC3D /* mugen.gif */,
0036ABB81BBD1D1400C6CC3D /* nailed.gif */,
);
Expand Down Expand Up @@ -271,6 +274,7 @@
files = (
0036ABB71BBD1D0B00C6CC3D /* mugen.gif in Resources */,
0036ABB91BBD1D1400C6CC3D /* nailed.gif in Resources */,
A5D726EA28B53D6400821347 /* earth.gif in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down

0 comments on commit 467eee5

Please sign in to comment.