Created
November 17, 2019 21:41
-
-
Save dmytro-anokhin/4320b82b71dd8db6f2afe9452e4f9275 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
func isFrameComplete(at index: Int) -> Bool { | |
assert(frameCount > index) | |
// CGImageSourceGetStatusAtIndex() changes the return status value from kCGImageStatusIncomplete | |
// to kCGImageStatusComplete only if (index > 1 && index < frameCount() - 1). To get an accurate | |
// result for the last frame (or the single frame of the static image) use CGImageSourceGetStatus() | |
// instead for this frame. | |
if index == frameCount - 1 { | |
return CGImageSourceGetStatus(imageSource) == .statusComplete | |
} | |
return CGImageSourceGetStatusAtIndex(imageSource, index) == .statusComplete | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment