-
Notifications
You must be signed in to change notification settings - Fork 286
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
Demo app fixes #182
Demo app fixes #182
Changes from all 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 |
---|---|---|
|
@@ -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] | ||
} | ||
} | ||
|
||
|
@@ -40,7 +39,7 @@ class ViewController: UIViewController { | |
} | ||
|
||
func animate() { | ||
imageView.animate(withGIFNamed: currentGIFName, animationBlock: { | ||
imageView.animate(withGIFNamed: currentGIFName, preparationBlock: { | ||
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.
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. Nice catch! |
||
DispatchQueue.main.async { | ||
self.imageDataLabel.text = self.currentGIFName.capitalized + " (\(self.imageView.frameCount) frames / \(String(format: "%.2f", self.imageView.gifLoopDuration))s)" | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 */ | ||
|
@@ -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 */ | ||
|
@@ -149,7 +153,9 @@ | |
9D98823A19BC69CA00B790C6 /* Supporting Files */ = { | ||
isa = PBXGroup; | ||
children = ( | ||
A5D726E728B53C0800821347 /* earth.gif */, | ||
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. Hard to review this change but before, only the 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. I was only trying the first one in my manual regression tests so never noticed. Thanks! |
||
002A1BFB1D1624D0005ABBD0 /* mugen.gif */, | ||
A5D726EB28B5599A00821347 /* nailed.gif */, | ||
); | ||
path = "Supporting Files"; | ||
sourceTree = "<group>"; | ||
|
@@ -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 */, | ||
|
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.
Cycle through all three GIFs (why not).