-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Reda Lemeden
committed
May 1, 2016
1 parent
47ef2e2
commit aa2e6a1
Showing
8 changed files
with
226 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
}, | ||
"data" : [ | ||
{ | ||
"idiom" : "universal", | ||
"filename" : "earth.gif" | ||
} | ||
] | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,27 @@ | ||
/// Keeps a reference to an `UIImage` instance and its duration as a GIF frame. | ||
struct AnimatedFrame { | ||
/// The image that should be used for this frame. | ||
let image: UIImage? | ||
/// The duration that the frame image should be displayed. | ||
let duration: NSTimeInterval | ||
|
||
static func null() -> AnimatedFrame { | ||
return AnimatedFrame(image: .None, duration: 0) | ||
/// A placeholder frame with no image assigned. | ||
/// Used to replace frames that are no longer needed in the animation. | ||
var placeholderFrame: AnimatedFrame { | ||
return AnimatedFrame(image: nil, duration: duration) | ||
} | ||
|
||
/// Whether the AnimatedFrame instance contains an image or not. | ||
var isPlaceholder: Bool { | ||
return image == .None | ||
} | ||
|
||
/// Takes an optional image and returns an non-placeholder `AnimatedFrame`. | ||
/// | ||
/// - parameter image: An optional `UIImage` instance to be assigned to the new frame. | ||
/// - returns: A non-placeholder `AnimatedFrame` instance. | ||
func frameWithImage(image: UIImage?) -> AnimatedFrame { | ||
return AnimatedFrame(image: image, duration: duration) | ||
} | ||
} | ||
|
Oops, something went wrong.