Update README and check-in docs

- Closes #79
This commit is contained in:
Reda Lemeden 2016-10-03 01:33:56 +02:00
parent 22397e9474
commit 3ac44fe7a9
37 changed files with 4013 additions and 42 deletions

1
.gitignore vendored
View File

@ -36,4 +36,3 @@ Carthage/Build
Gifu.framework.zip
*.xcscmblueprint
docs/

132
README.md
View File

@ -1,29 +1,14 @@
# ![Gifu](https://db.tt/mZ1iMNXO)
<h1><img src="https://github.com/kaishin/Gifu/raw/swift3/header.gif" alt="Gifu Logo" style="border-radius: 6px"></h1>
[![GitHub release](https://img.shields.io/github/release/kaishin/Gifu.svg?maxAge=2592000)](https://github.com/kaishin/Gifu/releases/latest) [![Travis](https://travis-ci.org/kaishin/Gifu.svg?branch=master)](https://travis-ci.org/kaishin/Gifu) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![Join the chat at https://gitter.im/kaishin/gifu](https://badges.gitter.im/kaishin/gifu.svg)](https://gitter.im/kaishin/gifu)
[![GitHub release](https://img.shields.io/github/release/kaishin/Gifu.svg?maxAge=2592000)](https://github.com/kaishin/Gifu/releases/latest) [![Travis](https://travis-ci.org/kaishin/Gifu.svg?branch=master)](https://travis-ci.org/kaishin/Gifu) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![Join the chat at https://gitter.im/kaishin/gifu](https://badges.gitter.im/kaishin/gifu.svg)](https://gitter.im/kaishin/gifu) ![Swift 3.0.x](https://img.shields.io/badge/Swift-3.0.x-orange.svg) ![platforms](https://img.shields.io/badge/platforms-iOS-lightgrey.svg)
Adds performant animated GIF support to UIKit. If you're looking for the Japanese prefecture, click [here](https://goo.gl/maps/CCeAc).
**Swift 3.0** support is in progress on the [swift3](https://github.com/kaishin/Gifu/tree/swift3) branch.
Gifu adds protocol-based, performance-aware animated GIF support to UIKit, without forcing you to use a `UIImageView` subclass. (It's also a [prefecture in Japan](https://goo.gl/maps/CCeAc)).
**Swift 2.3** support is on the [swift2.3](https://github.com/kaishin/Gifu/tree/swift2.3) branch. **This branch will not be getting any future updates**.
## Install
#### How?
Gifu uses a `UIImageView` subclass and an animator that keeps track of frames and their durations.
It uses `CADisplayLink` to animate the view and only keeps a limited number of
resized frames in-memory, which exponentially minimizes memory usage for large GIF files (+300 frames).
The figure below summarizes how this works in practice. Given an image
containing 10 frames, Gifu will load the current frame (red), pre-load the next two frames in this example (orange), and nullify all the other frames to free up memory (gray):
<img src="https://db.tt/ZLfx23hg" width="300" />
#### Install
#### [Carthage](https://github.com/Carthage/Carthage)
### [Carthage](https://github.com/Carthage/Carthage)
- Add the following to your Cartfile: `github "kaishin/Gifu"`
- Then run `carthage update`
@ -32,40 +17,111 @@ for up to date installation instructions.
[carthage-installation]: https://github.com/Carthage/Carthage#adding-frameworks-to-an-application
#### [CocoaPods](http://cocoapods.org)
### [CocoaPods](http://cocoapods.org)
- Add the following to your [Podfile](http://guides.cocoapods.org/using/the-podfile.html): `pod 'Gifu'`
- You will also need to make sure you're opting into using frameworks: `use_frameworks!`
- Then run `pod install` with CocoaPods 0.36 or newer.
#### Usage
## How It Works
Start by instantiating an `AnimatableImageView` either in code or Interface Builder, then call `animateWithImage(named:)` or `animateWithImageData(data:)` on it.
`Gifu` does not rely on subclassing `UIImageView`. The `Animator` class does the heavy-lifting, while the `GIFAnimatable` protocol exposes the functionality to the view classes that conform to it, using protocol extensions.
```swift
let imageView = AnimatableImageView(frame: CGRect(...))
imageView.animateWithImage(named: "mugen.gif")
```
You can stop the animation anytime using `imageView.stopAnimatingGIF()`, and resume
it using `imageView.startAnimatingGIF()`.
The `Animator` has a `FrameStore` that only keeps a limited number of frames in-memory, effectively creating a buffer for the animation without consuming all the available memory. This approach makes loading large GIFs a lot more resource-friendly.
The `isAnimatingGIF()` method returns the current animation state of the view if it has an animatable image.
The figure below summarizes how this works in practice. Given an image
containing 10 frames, Gifu will load the current frame (red), buffer the next two frames in this example (orange), and empty up all the other frames to free up memory (gray):
See the [full documentation](http://kaishin.github.io/Gifu/).
<img src="https://db.tt/ZLfx23hg" width="300" />
#### Demo App
## Usage
There are two options that should cover any situation:
- Use the built-in `GIFImageView` subclass.
- Make `UIImageView` or any of its subclasses conform to `GIFAnimatable`.
### GIFImageView
A subclass of `UIImageView` that conforms to `GIFAnimatable`. You can use this class as-is or subclass it for further customization (not recommended).
### GIFAnimatable
The bread and butter of Gifu. Through protocol extensions, `GIFAnimatable` exposes all the APIs of the library, and with very little boilerplate, any `UIImageView` subclass can conform to it.
~~~swift
class MyImageView: UIImageView, GIFAnimatable {
public lazy var animator: Animator? = {
return Animator(withDelegate: self)
}()
override public func display(_ layer: CALayer) {
updateImageIfNeeded()
}
}
~~~
That's it. Now `MyImageView` is fully GIF-compatible, and any of these methods can be called on it:
- `prepareForAnimation(withGIFNamed:)` and `prepareForAnimation(withGIFData:)` to prepare the animator property for animation.
- `startAnimatingGIF()` and `stopAnimatingGIF()` to control the animation.
- `animate(withGIFNamed:)` and `animate(withGIFData:)` to prepare for animation and start animating immediately.
- `frameCount`, `isAnimatingGIF`, and `activeFrame` to inspect the GIF view.
- `prepareForReuse()` to free up resources.
- `updateImageIfNeeded()` to update the image property if necessary.
### Examples
The simplest way to get started is initializing a `GIFAnimatable` class in code or in a storyboard, then calling `animate(:)` on it.
~~~swift
let imageView = GIFImageView(frame: CGRect(x: 0, y: 0, width: 200, height: 100))
imageView.animate(withGIFNamed: "mugen")
~~~
You can also prepare for the animation when the view loads and only start animating after a user interaction.
~~~swift
// In your view controller..
override func viewDidLoad() {
super.viewDidLoad()
imageView.prepareForAnimation(withGIFNamed: "mugen")
}
@IBAction func toggleAnimation(_ sender: AnyObject) {
if imageView.isAnimatingGIF {
imageView.stopAnimatingGIF()
} else {
imageView.startAnimatingGIF()
}
}
~~~
If you are using a `GIFAnimatable` class in a table or collection view, you can call the `prepareForReuse()` method in your cell subclass:
~~~swift
override func prepareForReuse() {
super.prepareForReuse()
imageView.prepareForReuse()
}
~~~
### Demo App
Clone or download the repository and open `Gifu.xcworkspace` to check out the demo app.
#### Compatibility
## Documentation
- iOS 8+
See the [full API documentation](http://kaishin.github.io/Gifu/).
#### Misc
- The font used in the logo is [Azuki](http://www.myfonts.com/fonts/bluevinyl/azuki/)
- The characters used in the icon and example image in the demo are from [Samurai Champloo](https://en.wikipedia.org/wiki/Samurai_Champloo).
## Compatibility
#### License
- iOS 9.0+
- Swift 3.0
- Xcode 8.0
## License
See LICENSE.

View File

@ -85,7 +85,8 @@ extension GIFAnimatable {
/// Updates the image with a new frame if necessary.
public func updateImageIfNeeded() {
image = animator?.activeFrame() ?? image
let frame = animator?.activeFrame() ?? image
if image != frame { image = frame }
}
}

View File

@ -15,11 +15,11 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.2.1</string>
<string>2.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>124</string>
<string>132</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>

134
docs/Classes.html Normal file
View File

@ -0,0 +1,134 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Classes Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset='utf-8'>
<script src="js/jquery.min.js" defer></script>
<script src="js/jazzy.js" defer></script>
</head>
<body>
<a title="Classes Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="index.html">Gifu Docs</a> (100% documented)</p>
<p class="header-right"><a href="https://github.com/kaishin/gifu/"><img src="img/gh.png"/>View on GitHub</a></p>
<p class="header-right"><a href="dash-feed://https%3A%2F%2Fpyroh%2Egithub%2Eio%2Fdocsets%2FGifu%2Exml"><img src="img/dash.png"/>Install in Dash</a></p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="index.html">Gifu Reference</a>
<img id="carat" src="img/carat.png" />
Classes Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Classes/Animator.html">Animator</a>
</li>
<li class="nav-group-task">
<a href="Classes/GIFImageView.html">GIFImageView</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Protocols/GIFAnimatable.html">GIFAnimatable</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>Classes</h1>
<p>The following classes are available globally.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:C4Gifu12GIFImageView"></a>
<a name="//apple_ref/swift/Class/GIFImageView" class="dashAnchor"></a>
<a class="token" href="#/s:C4Gifu12GIFImageView">GIFImageView</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Example class that conforms to <code><a href="Protocols/GIFAnimatable.html">GIFAnimatable</a></code>. Uses default values for the animator frame buffer count and resize behavior. You can either use it directly in your code or use it as a blueprint for your own subclass.</p>
<a href="Classes/GIFImageView.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">GIFImageView</span><span class="p">:</span> <span class="kt">UIImageView</span><span class="p">,</span> <span class="kt"><a href="Protocols/GIFAnimatable.html">GIFAnimatable</a></span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:C4Gifu8Animator"></a>
<a name="//apple_ref/swift/Class/Animator" class="dashAnchor"></a>
<a class="token" href="#/s:C4Gifu8Animator">Animator</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Responsible for parsing GIF data and decoding the individual frames.</p>
<a href="Classes/Animator.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">Animator</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>2015 © Reda Lemeden. See LICENSE for more details.</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.2</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

133
docs/Classes/Animator.html Normal file
View File

@ -0,0 +1,133 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Animator Class Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Class/Animator" class="dashAnchor"></a>
<a title="Animator Class Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html">Gifu Docs</a> (100% documented)</p>
<p class="header-right"><a href="https://github.com/kaishin/gifu/"><img src="../img/gh.png"/>View on GitHub</a></p>
<p class="header-right"><a href="dash-feed://https%3A%2F%2Fpyroh%2Egithub%2Eio%2Fdocsets%2FGifu%2Exml"><img src="../img/dash.png"/>Install in Dash</a></p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html">Gifu Reference</a>
<img id="carat" src="../img/carat.png" />
Animator Class Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/Animator.html">Animator</a>
</li>
<li class="nav-group-task">
<a href="../Classes/GIFImageView.html">GIFImageView</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/GIFAnimatable.html">GIFAnimatable</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>Animator</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">Animator</span></code></pre>
</div>
</div>
<p>Responsible for parsing GIF data and decoding the individual frames.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:FC4Gifu8AnimatorcFT12withDelegatePS_13GIFAnimatable__S0_"></a>
<a name="//apple_ref/swift/Method/init(withDelegate:)" class="dashAnchor"></a>
<a class="token" href="#/s:FC4Gifu8AnimatorcFT12withDelegatePS_13GIFAnimatable__S0_">init(withDelegate:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Creates a new animator with a delegate.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">withDelegate</span> <span class="nv">delegate</span><span class="p">:</span> <span class="kt"><a href="../Protocols/GIFAnimatable.html">GIFAnimatable</a></span><span class="p">)</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>view</em>
</code>
</td>
<td>
<div>
<p>A view object that implements the <code>GIFAnimatable</code> protocol.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h4>Return Value</h4>
<p>A new animator instance.</p>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>2015 © Reda Lemeden. See LICENSE for more details.</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.2</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,155 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>GIFImageView Class Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Class/GIFImageView" class="dashAnchor"></a>
<a title="GIFImageView Class Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html">Gifu Docs</a> (100% documented)</p>
<p class="header-right"><a href="https://github.com/kaishin/gifu/"><img src="../img/gh.png"/>View on GitHub</a></p>
<p class="header-right"><a href="dash-feed://https%3A%2F%2Fpyroh%2Egithub%2Eio%2Fdocsets%2FGifu%2Exml"><img src="../img/dash.png"/>Install in Dash</a></p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html">Gifu Reference</a>
<img id="carat" src="../img/carat.png" />
GIFImageView Class Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/Animator.html">Animator</a>
</li>
<li class="nav-group-task">
<a href="../Classes/GIFImageView.html">GIFImageView</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/GIFAnimatable.html">GIFAnimatable</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>GIFImageView</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">GIFImageView</span><span class="p">:</span> <span class="kt">UIImageView</span><span class="p">,</span> <span class="kt"><a href="../Protocols/GIFAnimatable.html">GIFAnimatable</a></span></code></pre>
</div>
</div>
<p>Example class that conforms to <code><a href="../Protocols/GIFAnimatable.html">GIFAnimatable</a></code>. Uses default values for the animator frame buffer count and resize behavior. You can either use it directly in your code or use it as a blueprint for your own subclass.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:vC4Gifu12GIFImageView8animatorGSqCS_8Animator_"></a>
<a name="//apple_ref/swift/Property/animator" class="dashAnchor"></a>
<a class="token" href="#/s:vC4Gifu12GIFImageView8animatorGSqCS_8Animator_">animator</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>A lazy animator.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">lazy</span> <span class="k">var</span> <span class="nv">animator</span><span class="p">:</span> <span class="kt"><a href="../Classes/Animator.html">Animator</a></span><span class="p">?</span> <span class="o">=</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:FC4Gifu12GIFImageView7displayFCSo7CALayerT_"></a>
<a name="//apple_ref/swift/Method/display(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:FC4Gifu12GIFImageView7displayFCSo7CALayerT_">display(_:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Layer delegate method called periodically by the layer. <strong>Should not</strong> be called manually.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">override</span> <span class="kd">public</span> <span class="kd">func</span> <span class="nf">display</span><span class="p">(</span><span class="n">_</span> <span class="nv">layer</span><span class="p">:</span> <span class="kt">CALayer</span><span class="p">)</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>layer</em>
</code>
</td>
<td>
<div>
<p>The delegated layer.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>2015 © Reda Lemeden. See LICENSE for more details.</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.2</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

102
docs/Protocols.html Normal file
View File

@ -0,0 +1,102 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Protocols Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset='utf-8'>
<script src="js/jquery.min.js" defer></script>
<script src="js/jazzy.js" defer></script>
</head>
<body>
<a title="Protocols Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="index.html">Gifu Docs</a> (100% documented)</p>
<p class="header-right"><a href="https://github.com/kaishin/gifu/"><img src="img/gh.png"/>View on GitHub</a></p>
<p class="header-right"><a href="dash-feed://https%3A%2F%2Fpyroh%2Egithub%2Eio%2Fdocsets%2FGifu%2Exml"><img src="img/dash.png"/>Install in Dash</a></p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="index.html">Gifu Reference</a>
<img id="carat" src="img/carat.png" />
Protocols Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Classes/Animator.html">Animator</a>
</li>
<li class="nav-group-task">
<a href="Classes/GIFImageView.html">GIFImageView</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Protocols/GIFAnimatable.html">GIFAnimatable</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>Protocols</h1>
<p>The following protocols are available globally.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:P4Gifu13GIFAnimatable"></a>
<a name="//apple_ref/swift/Protocol/GIFAnimatable" class="dashAnchor"></a>
<a class="token" href="#/s:P4Gifu13GIFAnimatable">GIFAnimatable</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The protocol that view classes need to conform to to enable animated GIF support.</p>
<a href="Protocols/GIFAnimatable.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">GIFAnimatable</span><span class="p">:</span> <span class="kd">class</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>2015 © Reda Lemeden. See LICENSE for more details.</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.2</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,660 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>GIFAnimatable Protocol Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Protocol/GIFAnimatable" class="dashAnchor"></a>
<a title="GIFAnimatable Protocol Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html">Gifu Docs</a> (100% documented)</p>
<p class="header-right"><a href="https://github.com/kaishin/gifu/"><img src="../img/gh.png"/>View on GitHub</a></p>
<p class="header-right"><a href="dash-feed://https%3A%2F%2Fpyroh%2Egithub%2Eio%2Fdocsets%2FGifu%2Exml"><img src="../img/dash.png"/>Install in Dash</a></p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html">Gifu Reference</a>
<img id="carat" src="../img/carat.png" />
GIFAnimatable Protocol Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/Animator.html">Animator</a>
</li>
<li class="nav-group-task">
<a href="../Classes/GIFImageView.html">GIFImageView</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/GIFAnimatable.html">GIFAnimatable</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>GIFAnimatable</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">GIFAnimatable</span><span class="p">:</span> <span class="kd">class</span></code></pre>
</div>
</div>
<p>The protocol that view classes need to conform to to enable animated GIF support.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:vP4Gifu13GIFAnimatable8animatorGSqCS_8Animator_"></a>
<a name="//apple_ref/swift/Property/animator" class="dashAnchor"></a>
<a class="token" href="#/s:vP4Gifu13GIFAnimatable8animatorGSqCS_8Animator_">animator</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Responsible for managing the animation frames.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">var</span> <span class="nv">animator</span><span class="p">:</span> <span class="kt"><a href="../Classes/Animator.html">Animator</a></span><span class="p">?</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:vP4Gifu13GIFAnimatable5imageGSqCSo7UIImage_"></a>
<a name="//apple_ref/swift/Property/image" class="dashAnchor"></a>
<a class="token" href="#/s:vP4Gifu13GIFAnimatable5imageGSqCSo7UIImage_">image</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Used for displaying the animation frames.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">var</span> <span class="nv">image</span><span class="p">:</span> <span class="kt">UIImage</span><span class="p">?</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:vP4Gifu13GIFAnimatable5layerCSo7CALayer"></a>
<a name="//apple_ref/swift/Property/layer" class="dashAnchor"></a>
<a class="token" href="#/s:vP4Gifu13GIFAnimatable5layerCSo7CALayer">layer</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Notifies the instance that it needs display.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">var</span> <span class="nv">layer</span><span class="p">:</span> <span class="kt">CALayer</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:vP4Gifu13GIFAnimatable5frameVSC6CGRect"></a>
<a name="//apple_ref/swift/Property/frame" class="dashAnchor"></a>
<a class="token" href="#/s:vP4Gifu13GIFAnimatable5frameVSC6CGRect">frame</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>View frame used for resizing the frames.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">var</span> <span class="nv">frame</span><span class="p">:</span> <span class="kt">CGRect</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:vP4Gifu13GIFAnimatable11contentModeOSC17UIViewContentMode"></a>
<a name="//apple_ref/swift/Property/contentMode" class="dashAnchor"></a>
<a class="token" href="#/s:vP4Gifu13GIFAnimatable11contentModeOSC17UIViewContentMode">contentMode</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Content mode used for resizing the frames.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">var</span> <span class="nv">contentMode</span><span class="p">:</span> <span class="kt">UIViewContentMode</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:vE4GifuPS_13GIFAnimatable20intrinsicContentSizeVSC6CGSize"></a>
<a name="//apple_ref/swift/Property/intrinsicContentSize" class="dashAnchor"></a>
<a class="token" href="#/s:vE4GifuPS_13GIFAnimatable20intrinsicContentSizeVSC6CGSize">intrinsicContentSize</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Returns the intrinsic content size based on the size of the image.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">intrinsicContentSize</span><span class="p">:</span> <span class="kt">CGSize</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:vE4GifuPS_13GIFAnimatable11activeFrameGSqCSo7UIImage_"></a>
<a name="//apple_ref/swift/Property/activeFrame" class="dashAnchor"></a>
<a class="token" href="#/s:vE4GifuPS_13GIFAnimatable11activeFrameGSqCSo7UIImage_">activeFrame</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Returns the active frame if available.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">activeFrame</span><span class="p">:</span> <span class="kt">UIImage</span><span class="p">?</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:vE4GifuPS_13GIFAnimatable10frameCountSi"></a>
<a name="//apple_ref/swift/Property/frameCount" class="dashAnchor"></a>
<a class="token" href="#/s:vE4GifuPS_13GIFAnimatable10frameCountSi">frameCount</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Total frame count of the GIF.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">frameCount</span><span class="p">:</span> <span class="kt">Int</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:vE4GifuPS_13GIFAnimatable14isAnimatingGIFSb"></a>
<a name="//apple_ref/swift/Property/isAnimatingGIF" class="dashAnchor"></a>
<a class="token" href="#/s:vE4GifuPS_13GIFAnimatable14isAnimatingGIFSb">isAnimatingGIF</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Introspect whether the instance is animating.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">isAnimatingGIF</span><span class="p">:</span> <span class="kt">Bool</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:FE4GifuPS_13GIFAnimatable7animateFT12withGIFNamedSS_T_"></a>
<a name="//apple_ref/swift/Method/animate(withGIFNamed:)" class="dashAnchor"></a>
<a class="token" href="#/s:FE4GifuPS_13GIFAnimatable7animateFT12withGIFNamedSS_T_">animate(withGIFNamed:)</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Prepare for animation and start animating immediately.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">animate</span><span class="p">(</span><span class="n">withGIFNamed</span> <span class="nv">imageName</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>imageName</em>
</code>
</td>
<td>
<div>
<p>The file name of the GIF in the main bundle.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:FE4GifuPS_13GIFAnimatable7animateFT11withGIFDataV10Foundation4Data_T_"></a>
<a name="//apple_ref/swift/Method/animate(withGIFData:)" class="dashAnchor"></a>
<a class="token" href="#/s:FE4GifuPS_13GIFAnimatable7animateFT11withGIFDataV10Foundation4Data_T_">animate(withGIFData:)</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Prepare for animation and start animating immediately.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">animate</span><span class="p">(</span><span class="n">withGIFData</span> <span class="nv">imageData</span><span class="p">:</span> <span class="kt">Data</span><span class="p">)</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>imageData</em>
</code>
</td>
<td>
<div>
<p>GIF image data.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:FE4GifuPS_13GIFAnimatable19prepareForAnimationFT12withGIFNamedSS_T_"></a>
<a name="//apple_ref/swift/Method/prepareForAnimation(withGIFNamed:)" class="dashAnchor"></a>
<a class="token" href="#/s:FE4GifuPS_13GIFAnimatable19prepareForAnimationFT12withGIFNamedSS_T_">prepareForAnimation(withGIFNamed:)</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Prepares the animator instance for animation.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">prepareForAnimation</span><span class="p">(</span><span class="n">withGIFNamed</span> <span class="nv">imageName</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>imageName</em>
</code>
</td>
<td>
<div>
<p>The file name of the GIF in the main bundle.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:FE4GifuPS_13GIFAnimatable19prepareForAnimationFT11withGIFDataV10Foundation4Data_T_"></a>
<a name="//apple_ref/swift/Method/prepareForAnimation(withGIFData:)" class="dashAnchor"></a>
<a class="token" href="#/s:FE4GifuPS_13GIFAnimatable19prepareForAnimationFT11withGIFDataV10Foundation4Data_T_">prepareForAnimation(withGIFData:)</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Prepare for animation and start animating immediately.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">prepareForAnimation</span><span class="p">(</span><span class="n">withGIFData</span> <span class="nv">imageData</span><span class="p">:</span> <span class="kt">Data</span><span class="p">)</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>imageData</em>
</code>
</td>
<td>
<div>
<p>GIF image data.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:FE4GifuPS_13GIFAnimatable15prepareForReuseFT_T_"></a>
<a name="//apple_ref/swift/Method/prepareForReuse()" class="dashAnchor"></a>
<a class="token" href="#/s:FE4GifuPS_13GIFAnimatable15prepareForReuseFT_T_">prepareForReuse()</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Stop animating and free up GIF data from memory.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">prepareForReuse</span><span class="p">()</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:FE4GifuPS_13GIFAnimatable17startAnimatingGIFFT_T_"></a>
<a name="//apple_ref/swift/Method/startAnimatingGIF()" class="dashAnchor"></a>
<a class="token" href="#/s:FE4GifuPS_13GIFAnimatable17startAnimatingGIFFT_T_">startAnimatingGIF()</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Start animating GIF.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">startAnimatingGIF</span><span class="p">()</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:FE4GifuPS_13GIFAnimatable16stopAnimatingGIFFT_T_"></a>
<a name="//apple_ref/swift/Method/stopAnimatingGIF()" class="dashAnchor"></a>
<a class="token" href="#/s:FE4GifuPS_13GIFAnimatable16stopAnimatingGIFFT_T_">stopAnimatingGIF()</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Stop animating GIF.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">stopAnimatingGIF</span><span class="p">()</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:FE4GifuPS_13GIFAnimatable19updateImageIfNeededFT_T_"></a>
<a name="//apple_ref/swift/Method/updateImageIfNeeded()" class="dashAnchor"></a>
<a class="token" href="#/s:FE4GifuPS_13GIFAnimatable19updateImageIfNeededFT_T_">updateImageIfNeeded()</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Updates the image with a new frame if necessary.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">updateImageIfNeeded</span><span class="p">()</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>2015 © Reda Lemeden. See LICENSE for more details.</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.2</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

200
docs/css/highlight.css Normal file
View File

@ -0,0 +1,200 @@
/* Credit to https://gist.github.com/wataru420/2048287 */
.highlight {
/* Comment */
/* Error */
/* Keyword */
/* Operator */
/* Comment.Multiline */
/* Comment.Preproc */
/* Comment.Single */
/* Comment.Special */
/* Generic.Deleted */
/* Generic.Deleted.Specific */
/* Generic.Emph */
/* Generic.Error */
/* Generic.Heading */
/* Generic.Inserted */
/* Generic.Inserted.Specific */
/* Generic.Output */
/* Generic.Prompt */
/* Generic.Strong */
/* Generic.Subheading */
/* Generic.Traceback */
/* Keyword.Constant */
/* Keyword.Declaration */
/* Keyword.Pseudo */
/* Keyword.Reserved */
/* Keyword.Type */
/* Literal.Number */
/* Literal.String */
/* Name.Attribute */
/* Name.Builtin */
/* Name.Class */
/* Name.Constant */
/* Name.Entity */
/* Name.Exception */
/* Name.Function */
/* Name.Namespace */
/* Name.Tag */
/* Name.Variable */
/* Operator.Word */
/* Text.Whitespace */
/* Literal.Number.Float */
/* Literal.Number.Hex */
/* Literal.Number.Integer */
/* Literal.Number.Oct */
/* Literal.String.Backtick */
/* Literal.String.Char */
/* Literal.String.Doc */
/* Literal.String.Double */
/* Literal.String.Escape */
/* Literal.String.Heredoc */
/* Literal.String.Interpol */
/* Literal.String.Other */
/* Literal.String.Regex */
/* Literal.String.Single */
/* Literal.String.Symbol */
/* Name.Builtin.Pseudo */
/* Name.Variable.Class */
/* Name.Variable.Global */
/* Name.Variable.Instance */
/* Literal.Number.Integer.Long */ }
.highlight .c {
color: #999988;
font-style: italic; }
.highlight .err {
color: #a61717;
background-color: #e3d2d2; }
.highlight .k {
color: #000000;
font-weight: bold; }
.highlight .o {
color: #000000;
font-weight: bold; }
.highlight .cm {
color: #999988;
font-style: italic; }
.highlight .cp {
color: #999999;
font-weight: bold; }
.highlight .c1 {
color: #999988;
font-style: italic; }
.highlight .cs {
color: #999999;
font-weight: bold;
font-style: italic; }
.highlight .gd {
color: #000000;
background-color: #ffdddd; }
.highlight .gd .x {
color: #000000;
background-color: #ffaaaa; }
.highlight .ge {
color: #000000;
font-style: italic; }
.highlight .gr {
color: #aa0000; }
.highlight .gh {
color: #999999; }
.highlight .gi {
color: #000000;
background-color: #ddffdd; }
.highlight .gi .x {
color: #000000;
background-color: #aaffaa; }
.highlight .go {
color: #888888; }
.highlight .gp {
color: #555555; }
.highlight .gs {
font-weight: bold; }
.highlight .gu {
color: #aaaaaa; }
.highlight .gt {
color: #aa0000; }
.highlight .kc {
color: #000000;
font-weight: bold; }
.highlight .kd {
color: #000000;
font-weight: bold; }
.highlight .kp {
color: #000000;
font-weight: bold; }
.highlight .kr {
color: #000000;
font-weight: bold; }
.highlight .kt {
color: #445588; }
.highlight .m {
color: #009999; }
.highlight .s {
color: #d14; }
.highlight .na {
color: #008080; }
.highlight .nb {
color: #0086B3; }
.highlight .nc {
color: #445588;
font-weight: bold; }
.highlight .no {
color: #008080; }
.highlight .ni {
color: #800080; }
.highlight .ne {
color: #990000;
font-weight: bold; }
.highlight .nf {
color: #990000; }
.highlight .nn {
color: #555555; }
.highlight .nt {
color: #000080; }
.highlight .nv {
color: #008080; }
.highlight .ow {
color: #000000;
font-weight: bold; }
.highlight .w {
color: #bbbbbb; }
.highlight .mf {
color: #009999; }
.highlight .mh {
color: #009999; }
.highlight .mi {
color: #009999; }
.highlight .mo {
color: #009999; }
.highlight .sb {
color: #d14; }
.highlight .sc {
color: #d14; }
.highlight .sd {
color: #d14; }
.highlight .s2 {
color: #d14; }
.highlight .se {
color: #d14; }
.highlight .sh {
color: #d14; }
.highlight .si {
color: #d14; }
.highlight .sx {
color: #d14; }
.highlight .sr {
color: #009926; }
.highlight .s1 {
color: #d14; }
.highlight .ss {
color: #990073; }
.highlight .bp {
color: #999999; }
.highlight .vc {
color: #008080; }
.highlight .vg {
color: #008080; }
.highlight .vi {
color: #008080; }
.highlight .il {
color: #009999; }

332
docs/css/jazzy.css Normal file
View File

@ -0,0 +1,332 @@
html, body, div, span, h1, h3, h4, p, a, code, em, img, ul, li, table, tbody, tr, td {
background: transparent;
border: 0;
margin: 0;
outline: 0;
padding: 0;
vertical-align: baseline; }
body {
background-color: #f2f2f2;
font-family: Helvetica, freesans, Arial, sans-serif;
font-size: 14px;
-webkit-font-smoothing: subpixel-antialiased;
word-wrap: break-word; }
h1, h2, h3 {
margin-top: 0.8em;
margin-bottom: 0.3em;
font-weight: 100;
color: black; }
h1 {
font-size: 2.5em; }
h2 {
font-size: 2em;
border-bottom: 1px solid #e2e2e2; }
h4 {
font-size: 13px;
line-height: 1.5;
margin-top: 21px; }
h5 {
font-size: 1.1em; }
h6 {
font-size: 1.1em;
color: #777; }
.section-name {
color: gray;
display: block;
font-family: Helvetica;
font-size: 22px;
font-weight: 100;
margin-bottom: 15px; }
pre, code {
font: 0.95em Menlo, monospace;
color: #777;
word-wrap: normal; }
p code, li code {
background-color: #eee;
padding: 2px 4px;
border-radius: 4px; }
a {
color: #0088cc;
text-decoration: none; }
ul {
padding-left: 15px; }
li {
line-height: 1.8em; }
img {
max-width: 100%; }
blockquote {
margin-left: 0;
padding: 0 10px;
border-left: 4px solid #ccc; }
.content-wrapper {
margin: 0 auto;
width: 980px; }
header {
font-size: 0.85em;
line-height: 26px;
background-color: #414141;
position: fixed;
width: 100%;
z-index: 1; }
header img {
padding-right: 6px;
vertical-align: -4px;
height: 16px; }
header a {
color: #fff; }
header p {
float: left;
color: #999; }
header .header-right {
float: right;
margin-left: 16px; }
#breadcrumbs {
background-color: #f2f2f2;
height: 27px;
padding-top: 17px;
position: fixed;
width: 100%;
z-index: 1;
margin-top: 26px; }
#breadcrumbs #carat {
height: 10px;
margin: 0 5px; }
.sidebar {
background-color: #f9f9f9;
border: 1px solid #e2e2e2;
overflow-y: auto;
overflow-x: hidden;
position: fixed;
top: 70px;
bottom: 0;
width: 230px;
word-wrap: normal; }
.nav-groups {
list-style-type: none;
background: #fff;
padding-left: 0; }
.nav-group-name {
border-bottom: 1px solid #e2e2e2;
font-size: 1.1em;
font-weight: 100;
padding: 15px 0 15px 20px; }
.nav-group-name > a {
color: #333; }
.nav-group-tasks {
margin-top: 5px; }
.nav-group-task {
font-size: 0.9em;
list-style-type: none;
white-space: nowrap; }
.nav-group-task a {
color: #888; }
.main-content {
background-color: #fff;
border: 1px solid #e2e2e2;
margin-left: 246px;
position: absolute;
overflow: hidden;
padding-bottom: 60px;
top: 70px;
width: 734px; }
.main-content p, .main-content a, .main-content code, .main-content em, .main-content ul, .main-content table, .main-content blockquote {
margin-bottom: 1em; }
.main-content p {
line-height: 1.8em; }
.main-content section .section:first-child {
margin-top: 0;
padding-top: 0; }
.main-content section .task-group-section .task-group:first-of-type {
padding-top: 10px; }
.main-content section .task-group-section .task-group:first-of-type .section-name {
padding-top: 15px; }
.section {
padding: 0 25px; }
.highlight {
background-color: #eee;
padding: 10px 12px;
border: 1px solid #e2e2e2;
border-radius: 4px;
overflow-x: auto; }
.declaration .highlight {
overflow-x: initial;
padding: 0 40px 40px 0;
margin-bottom: -25px;
background-color: transparent;
border: none; }
.section-name {
margin: 0;
margin-left: 18px; }
.task-group-section {
padding-left: 6px;
border-top: 1px solid #e2e2e2; }
.task-group {
padding-top: 0px; }
.task-name-container a[name]:before {
content: "";
display: block;
padding-top: 70px;
margin: -70px 0 0; }
.item {
padding-top: 8px;
width: 100%;
list-style-type: none; }
.item a[name]:before {
content: "";
display: block;
padding-top: 70px;
margin: -70px 0 0; }
.item code {
background-color: transparent;
padding: 0; }
.item .token {
padding-left: 3px;
margin-left: 15px;
font-size: 11.9px; }
.item .declaration-note {
font-size: .85em;
color: gray;
font-style: italic; }
.pointer-container {
border-bottom: 1px solid #e2e2e2;
left: -23px;
padding-bottom: 13px;
position: relative;
width: 110%; }
.pointer {
background: #f9f9f9;
border-left: 1px solid #e2e2e2;
border-top: 1px solid #e2e2e2;
height: 12px;
left: 21px;
top: -7px;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
position: absolute;
width: 12px; }
.height-container {
display: none;
left: -25px;
padding: 0 25px;
position: relative;
width: 100%;
overflow: hidden; }
.height-container .section {
background: #f9f9f9;
border-bottom: 1px solid #e2e2e2;
left: -25px;
position: relative;
width: 100%;
padding-top: 10px;
padding-bottom: 5px; }
.aside, .language {
padding: 6px 12px;
margin: 12px 0;
border-left: 5px solid #dddddd;
overflow-y: hidden; }
.aside .aside-title, .language .aside-title {
font-size: 9px;
letter-spacing: 2px;
text-transform: uppercase;
padding-bottom: 0;
margin: 0;
color: #aaa;
-webkit-user-select: none; }
.aside p:last-child, .language p:last-child {
margin-bottom: 0; }
.language {
border-left: 5px solid #cde9f4; }
.language .aside-title {
color: #4b8afb; }
.aside-warning {
border-left: 5px solid #ff6666; }
.aside-warning .aside-title {
color: #ff0000; }
.graybox {
border-collapse: collapse;
width: 100%; }
.graybox p {
margin: 0;
word-break: break-word;
min-width: 50px; }
.graybox td {
border: 1px solid #e2e2e2;
padding: 5px 25px 5px 10px;
vertical-align: middle; }
.graybox tr td:first-of-type {
text-align: right;
padding: 7px;
vertical-align: top;
word-break: normal;
width: 40px; }
.slightly-smaller {
font-size: 0.9em; }
#footer {
position: absolute;
bottom: 10px;
margin-left: 25px; }
#footer p {
margin: 0;
color: #aaa;
font-size: 0.8em; }
html.dash header, html.dash #breadcrumbs, html.dash .sidebar {
display: none; }
html.dash .main-content {
width: 980px;
margin-left: 0;
border: none;
width: 100%;
top: 0;
padding-bottom: 0; }
html.dash .height-container {
display: block; }
html.dash .item .token {
margin-left: 0; }
html.dash .content-wrapper {
width: auto; }
html.dash #footer {
position: static; }

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIdentifier</key>
<string>com.jazzy.gifu</string>
<key>CFBundleName</key>
<string>Gifu</string>
<key>DocSetPlatformFamily</key>
<string>gifu</string>
<key>isDashDocset</key>
<true/>
<key>dashIndexFilePath</key>
<string>index.html</string>
<key>isJavaScriptEnabled</key>
<true/>
<key>DashDocSetFamily</key>
<string>dashtoc</string>
</dict>
</plist>

View File

@ -0,0 +1,134 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Classes Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset='utf-8'>
<script src="js/jquery.min.js" defer></script>
<script src="js/jazzy.js" defer></script>
</head>
<body>
<a title="Classes Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="index.html">Gifu Docs</a> (100% documented)</p>
<p class="header-right"><a href="https://github.com/kaishin/gifu/"><img src="img/gh.png"/>View on GitHub</a></p>
<p class="header-right"><a href="dash-feed://https%3A%2F%2Fpyroh%2Egithub%2Eio%2Fdocsets%2FGifu%2Exml"><img src="img/dash.png"/>Install in Dash</a></p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="index.html">Gifu Reference</a>
<img id="carat" src="img/carat.png" />
Classes Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Classes/Animator.html">Animator</a>
</li>
<li class="nav-group-task">
<a href="Classes/GIFImageView.html">GIFImageView</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Protocols/GIFAnimatable.html">GIFAnimatable</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>Classes</h1>
<p>The following classes are available globally.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:C4Gifu12GIFImageView"></a>
<a name="//apple_ref/swift/Class/GIFImageView" class="dashAnchor"></a>
<a class="token" href="#/s:C4Gifu12GIFImageView">GIFImageView</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Example class that conforms to <code><a href="Protocols/GIFAnimatable.html">GIFAnimatable</a></code>. Uses default values for the animator frame buffer count and resize behavior. You can either use it directly in your code or use it as a blueprint for your own subclass.</p>
<a href="Classes/GIFImageView.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">GIFImageView</span><span class="p">:</span> <span class="kt">UIImageView</span><span class="p">,</span> <span class="kt"><a href="Protocols/GIFAnimatable.html">GIFAnimatable</a></span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:C4Gifu8Animator"></a>
<a name="//apple_ref/swift/Class/Animator" class="dashAnchor"></a>
<a class="token" href="#/s:C4Gifu8Animator">Animator</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Responsible for parsing GIF data and decoding the individual frames.</p>
<a href="Classes/Animator.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">Animator</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>2015 © Reda Lemeden. See LICENSE for more details.</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.2</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,133 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Animator Class Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Class/Animator" class="dashAnchor"></a>
<a title="Animator Class Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html">Gifu Docs</a> (100% documented)</p>
<p class="header-right"><a href="https://github.com/kaishin/gifu/"><img src="../img/gh.png"/>View on GitHub</a></p>
<p class="header-right"><a href="dash-feed://https%3A%2F%2Fpyroh%2Egithub%2Eio%2Fdocsets%2FGifu%2Exml"><img src="../img/dash.png"/>Install in Dash</a></p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html">Gifu Reference</a>
<img id="carat" src="../img/carat.png" />
Animator Class Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/Animator.html">Animator</a>
</li>
<li class="nav-group-task">
<a href="../Classes/GIFImageView.html">GIFImageView</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/GIFAnimatable.html">GIFAnimatable</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>Animator</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">Animator</span></code></pre>
</div>
</div>
<p>Responsible for parsing GIF data and decoding the individual frames.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:FC4Gifu8AnimatorcFT12withDelegatePS_13GIFAnimatable__S0_"></a>
<a name="//apple_ref/swift/Method/init(withDelegate:)" class="dashAnchor"></a>
<a class="token" href="#/s:FC4Gifu8AnimatorcFT12withDelegatePS_13GIFAnimatable__S0_">init(withDelegate:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Creates a new animator with a delegate.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">withDelegate</span> <span class="nv">delegate</span><span class="p">:</span> <span class="kt"><a href="../Protocols/GIFAnimatable.html">GIFAnimatable</a></span><span class="p">)</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>view</em>
</code>
</td>
<td>
<div>
<p>A view object that implements the <code>GIFAnimatable</code> protocol.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h4>Return Value</h4>
<p>A new animator instance.</p>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>2015 © Reda Lemeden. See LICENSE for more details.</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.2</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,155 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>GIFImageView Class Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Class/GIFImageView" class="dashAnchor"></a>
<a title="GIFImageView Class Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html">Gifu Docs</a> (100% documented)</p>
<p class="header-right"><a href="https://github.com/kaishin/gifu/"><img src="../img/gh.png"/>View on GitHub</a></p>
<p class="header-right"><a href="dash-feed://https%3A%2F%2Fpyroh%2Egithub%2Eio%2Fdocsets%2FGifu%2Exml"><img src="../img/dash.png"/>Install in Dash</a></p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html">Gifu Reference</a>
<img id="carat" src="../img/carat.png" />
GIFImageView Class Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/Animator.html">Animator</a>
</li>
<li class="nav-group-task">
<a href="../Classes/GIFImageView.html">GIFImageView</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/GIFAnimatable.html">GIFAnimatable</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>GIFImageView</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">GIFImageView</span><span class="p">:</span> <span class="kt">UIImageView</span><span class="p">,</span> <span class="kt"><a href="../Protocols/GIFAnimatable.html">GIFAnimatable</a></span></code></pre>
</div>
</div>
<p>Example class that conforms to <code><a href="../Protocols/GIFAnimatable.html">GIFAnimatable</a></code>. Uses default values for the animator frame buffer count and resize behavior. You can either use it directly in your code or use it as a blueprint for your own subclass.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:vC4Gifu12GIFImageView8animatorGSqCS_8Animator_"></a>
<a name="//apple_ref/swift/Property/animator" class="dashAnchor"></a>
<a class="token" href="#/s:vC4Gifu12GIFImageView8animatorGSqCS_8Animator_">animator</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>A lazy animator.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">lazy</span> <span class="k">var</span> <span class="nv">animator</span><span class="p">:</span> <span class="kt"><a href="../Classes/Animator.html">Animator</a></span><span class="p">?</span> <span class="o">=</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:FC4Gifu12GIFImageView7displayFCSo7CALayerT_"></a>
<a name="//apple_ref/swift/Method/display(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:FC4Gifu12GIFImageView7displayFCSo7CALayerT_">display(_:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Layer delegate method called periodically by the layer. <strong>Should not</strong> be called manually.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">override</span> <span class="kd">public</span> <span class="kd">func</span> <span class="nf">display</span><span class="p">(</span><span class="n">_</span> <span class="nv">layer</span><span class="p">:</span> <span class="kt">CALayer</span><span class="p">)</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>layer</em>
</code>
</td>
<td>
<div>
<p>The delegated layer.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>2015 © Reda Lemeden. See LICENSE for more details.</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.2</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,102 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Protocols Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset='utf-8'>
<script src="js/jquery.min.js" defer></script>
<script src="js/jazzy.js" defer></script>
</head>
<body>
<a title="Protocols Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="index.html">Gifu Docs</a> (100% documented)</p>
<p class="header-right"><a href="https://github.com/kaishin/gifu/"><img src="img/gh.png"/>View on GitHub</a></p>
<p class="header-right"><a href="dash-feed://https%3A%2F%2Fpyroh%2Egithub%2Eio%2Fdocsets%2FGifu%2Exml"><img src="img/dash.png"/>Install in Dash</a></p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="index.html">Gifu Reference</a>
<img id="carat" src="img/carat.png" />
Protocols Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Classes/Animator.html">Animator</a>
</li>
<li class="nav-group-task">
<a href="Classes/GIFImageView.html">GIFImageView</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Protocols/GIFAnimatable.html">GIFAnimatable</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>Protocols</h1>
<p>The following protocols are available globally.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:P4Gifu13GIFAnimatable"></a>
<a name="//apple_ref/swift/Protocol/GIFAnimatable" class="dashAnchor"></a>
<a class="token" href="#/s:P4Gifu13GIFAnimatable">GIFAnimatable</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The protocol that view classes need to conform to to enable animated GIF support.</p>
<a href="Protocols/GIFAnimatable.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">GIFAnimatable</span><span class="p">:</span> <span class="kd">class</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>2015 © Reda Lemeden. See LICENSE for more details.</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.2</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,660 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>GIFAnimatable Protocol Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Protocol/GIFAnimatable" class="dashAnchor"></a>
<a title="GIFAnimatable Protocol Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html">Gifu Docs</a> (100% documented)</p>
<p class="header-right"><a href="https://github.com/kaishin/gifu/"><img src="../img/gh.png"/>View on GitHub</a></p>
<p class="header-right"><a href="dash-feed://https%3A%2F%2Fpyroh%2Egithub%2Eio%2Fdocsets%2FGifu%2Exml"><img src="../img/dash.png"/>Install in Dash</a></p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html">Gifu Reference</a>
<img id="carat" src="../img/carat.png" />
GIFAnimatable Protocol Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/Animator.html">Animator</a>
</li>
<li class="nav-group-task">
<a href="../Classes/GIFImageView.html">GIFImageView</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/GIFAnimatable.html">GIFAnimatable</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>GIFAnimatable</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">GIFAnimatable</span><span class="p">:</span> <span class="kd">class</span></code></pre>
</div>
</div>
<p>The protocol that view classes need to conform to to enable animated GIF support.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:vP4Gifu13GIFAnimatable8animatorGSqCS_8Animator_"></a>
<a name="//apple_ref/swift/Property/animator" class="dashAnchor"></a>
<a class="token" href="#/s:vP4Gifu13GIFAnimatable8animatorGSqCS_8Animator_">animator</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Responsible for managing the animation frames.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">var</span> <span class="nv">animator</span><span class="p">:</span> <span class="kt"><a href="../Classes/Animator.html">Animator</a></span><span class="p">?</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:vP4Gifu13GIFAnimatable5imageGSqCSo7UIImage_"></a>
<a name="//apple_ref/swift/Property/image" class="dashAnchor"></a>
<a class="token" href="#/s:vP4Gifu13GIFAnimatable5imageGSqCSo7UIImage_">image</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Used for displaying the animation frames.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">var</span> <span class="nv">image</span><span class="p">:</span> <span class="kt">UIImage</span><span class="p">?</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:vP4Gifu13GIFAnimatable5layerCSo7CALayer"></a>
<a name="//apple_ref/swift/Property/layer" class="dashAnchor"></a>
<a class="token" href="#/s:vP4Gifu13GIFAnimatable5layerCSo7CALayer">layer</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Notifies the instance that it needs display.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">var</span> <span class="nv">layer</span><span class="p">:</span> <span class="kt">CALayer</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:vP4Gifu13GIFAnimatable5frameVSC6CGRect"></a>
<a name="//apple_ref/swift/Property/frame" class="dashAnchor"></a>
<a class="token" href="#/s:vP4Gifu13GIFAnimatable5frameVSC6CGRect">frame</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>View frame used for resizing the frames.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">var</span> <span class="nv">frame</span><span class="p">:</span> <span class="kt">CGRect</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:vP4Gifu13GIFAnimatable11contentModeOSC17UIViewContentMode"></a>
<a name="//apple_ref/swift/Property/contentMode" class="dashAnchor"></a>
<a class="token" href="#/s:vP4Gifu13GIFAnimatable11contentModeOSC17UIViewContentMode">contentMode</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Content mode used for resizing the frames.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">var</span> <span class="nv">contentMode</span><span class="p">:</span> <span class="kt">UIViewContentMode</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:vE4GifuPS_13GIFAnimatable20intrinsicContentSizeVSC6CGSize"></a>
<a name="//apple_ref/swift/Property/intrinsicContentSize" class="dashAnchor"></a>
<a class="token" href="#/s:vE4GifuPS_13GIFAnimatable20intrinsicContentSizeVSC6CGSize">intrinsicContentSize</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Returns the intrinsic content size based on the size of the image.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">intrinsicContentSize</span><span class="p">:</span> <span class="kt">CGSize</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:vE4GifuPS_13GIFAnimatable11activeFrameGSqCSo7UIImage_"></a>
<a name="//apple_ref/swift/Property/activeFrame" class="dashAnchor"></a>
<a class="token" href="#/s:vE4GifuPS_13GIFAnimatable11activeFrameGSqCSo7UIImage_">activeFrame</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Returns the active frame if available.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">activeFrame</span><span class="p">:</span> <span class="kt">UIImage</span><span class="p">?</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:vE4GifuPS_13GIFAnimatable10frameCountSi"></a>
<a name="//apple_ref/swift/Property/frameCount" class="dashAnchor"></a>
<a class="token" href="#/s:vE4GifuPS_13GIFAnimatable10frameCountSi">frameCount</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Total frame count of the GIF.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">frameCount</span><span class="p">:</span> <span class="kt">Int</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:vE4GifuPS_13GIFAnimatable14isAnimatingGIFSb"></a>
<a name="//apple_ref/swift/Property/isAnimatingGIF" class="dashAnchor"></a>
<a class="token" href="#/s:vE4GifuPS_13GIFAnimatable14isAnimatingGIFSb">isAnimatingGIF</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Introspect whether the instance is animating.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">isAnimatingGIF</span><span class="p">:</span> <span class="kt">Bool</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:FE4GifuPS_13GIFAnimatable7animateFT12withGIFNamedSS_T_"></a>
<a name="//apple_ref/swift/Method/animate(withGIFNamed:)" class="dashAnchor"></a>
<a class="token" href="#/s:FE4GifuPS_13GIFAnimatable7animateFT12withGIFNamedSS_T_">animate(withGIFNamed:)</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Prepare for animation and start animating immediately.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">animate</span><span class="p">(</span><span class="n">withGIFNamed</span> <span class="nv">imageName</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>imageName</em>
</code>
</td>
<td>
<div>
<p>The file name of the GIF in the main bundle.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:FE4GifuPS_13GIFAnimatable7animateFT11withGIFDataV10Foundation4Data_T_"></a>
<a name="//apple_ref/swift/Method/animate(withGIFData:)" class="dashAnchor"></a>
<a class="token" href="#/s:FE4GifuPS_13GIFAnimatable7animateFT11withGIFDataV10Foundation4Data_T_">animate(withGIFData:)</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Prepare for animation and start animating immediately.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">animate</span><span class="p">(</span><span class="n">withGIFData</span> <span class="nv">imageData</span><span class="p">:</span> <span class="kt">Data</span><span class="p">)</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>imageData</em>
</code>
</td>
<td>
<div>
<p>GIF image data.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:FE4GifuPS_13GIFAnimatable19prepareForAnimationFT12withGIFNamedSS_T_"></a>
<a name="//apple_ref/swift/Method/prepareForAnimation(withGIFNamed:)" class="dashAnchor"></a>
<a class="token" href="#/s:FE4GifuPS_13GIFAnimatable19prepareForAnimationFT12withGIFNamedSS_T_">prepareForAnimation(withGIFNamed:)</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Prepares the animator instance for animation.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">prepareForAnimation</span><span class="p">(</span><span class="n">withGIFNamed</span> <span class="nv">imageName</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>imageName</em>
</code>
</td>
<td>
<div>
<p>The file name of the GIF in the main bundle.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:FE4GifuPS_13GIFAnimatable19prepareForAnimationFT11withGIFDataV10Foundation4Data_T_"></a>
<a name="//apple_ref/swift/Method/prepareForAnimation(withGIFData:)" class="dashAnchor"></a>
<a class="token" href="#/s:FE4GifuPS_13GIFAnimatable19prepareForAnimationFT11withGIFDataV10Foundation4Data_T_">prepareForAnimation(withGIFData:)</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Prepare for animation and start animating immediately.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">prepareForAnimation</span><span class="p">(</span><span class="n">withGIFData</span> <span class="nv">imageData</span><span class="p">:</span> <span class="kt">Data</span><span class="p">)</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>imageData</em>
</code>
</td>
<td>
<div>
<p>GIF image data.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:FE4GifuPS_13GIFAnimatable15prepareForReuseFT_T_"></a>
<a name="//apple_ref/swift/Method/prepareForReuse()" class="dashAnchor"></a>
<a class="token" href="#/s:FE4GifuPS_13GIFAnimatable15prepareForReuseFT_T_">prepareForReuse()</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Stop animating and free up GIF data from memory.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">prepareForReuse</span><span class="p">()</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:FE4GifuPS_13GIFAnimatable17startAnimatingGIFFT_T_"></a>
<a name="//apple_ref/swift/Method/startAnimatingGIF()" class="dashAnchor"></a>
<a class="token" href="#/s:FE4GifuPS_13GIFAnimatable17startAnimatingGIFFT_T_">startAnimatingGIF()</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Start animating GIF.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">startAnimatingGIF</span><span class="p">()</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:FE4GifuPS_13GIFAnimatable16stopAnimatingGIFFT_T_"></a>
<a name="//apple_ref/swift/Method/stopAnimatingGIF()" class="dashAnchor"></a>
<a class="token" href="#/s:FE4GifuPS_13GIFAnimatable16stopAnimatingGIFFT_T_">stopAnimatingGIF()</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Stop animating GIF.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">stopAnimatingGIF</span><span class="p">()</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:FE4GifuPS_13GIFAnimatable19updateImageIfNeededFT_T_"></a>
<a name="//apple_ref/swift/Method/updateImageIfNeeded()" class="dashAnchor"></a>
<a class="token" href="#/s:FE4GifuPS_13GIFAnimatable19updateImageIfNeededFT_T_">updateImageIfNeeded()</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Updates the image with a new frame if necessary.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">updateImageIfNeeded</span><span class="p">()</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>2015 © Reda Lemeden. See LICENSE for more details.</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.2</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,200 @@
/* Credit to https://gist.github.com/wataru420/2048287 */
.highlight {
/* Comment */
/* Error */
/* Keyword */
/* Operator */
/* Comment.Multiline */
/* Comment.Preproc */
/* Comment.Single */
/* Comment.Special */
/* Generic.Deleted */
/* Generic.Deleted.Specific */
/* Generic.Emph */
/* Generic.Error */
/* Generic.Heading */
/* Generic.Inserted */
/* Generic.Inserted.Specific */
/* Generic.Output */
/* Generic.Prompt */
/* Generic.Strong */
/* Generic.Subheading */
/* Generic.Traceback */
/* Keyword.Constant */
/* Keyword.Declaration */
/* Keyword.Pseudo */
/* Keyword.Reserved */
/* Keyword.Type */
/* Literal.Number */
/* Literal.String */
/* Name.Attribute */
/* Name.Builtin */
/* Name.Class */
/* Name.Constant */
/* Name.Entity */
/* Name.Exception */
/* Name.Function */
/* Name.Namespace */
/* Name.Tag */
/* Name.Variable */
/* Operator.Word */
/* Text.Whitespace */
/* Literal.Number.Float */
/* Literal.Number.Hex */
/* Literal.Number.Integer */
/* Literal.Number.Oct */
/* Literal.String.Backtick */
/* Literal.String.Char */
/* Literal.String.Doc */
/* Literal.String.Double */
/* Literal.String.Escape */
/* Literal.String.Heredoc */
/* Literal.String.Interpol */
/* Literal.String.Other */
/* Literal.String.Regex */
/* Literal.String.Single */
/* Literal.String.Symbol */
/* Name.Builtin.Pseudo */
/* Name.Variable.Class */
/* Name.Variable.Global */
/* Name.Variable.Instance */
/* Literal.Number.Integer.Long */ }
.highlight .c {
color: #999988;
font-style: italic; }
.highlight .err {
color: #a61717;
background-color: #e3d2d2; }
.highlight .k {
color: #000000;
font-weight: bold; }
.highlight .o {
color: #000000;
font-weight: bold; }
.highlight .cm {
color: #999988;
font-style: italic; }
.highlight .cp {
color: #999999;
font-weight: bold; }
.highlight .c1 {
color: #999988;
font-style: italic; }
.highlight .cs {
color: #999999;
font-weight: bold;
font-style: italic; }
.highlight .gd {
color: #000000;
background-color: #ffdddd; }
.highlight .gd .x {
color: #000000;
background-color: #ffaaaa; }
.highlight .ge {
color: #000000;
font-style: italic; }
.highlight .gr {
color: #aa0000; }
.highlight .gh {
color: #999999; }
.highlight .gi {
color: #000000;
background-color: #ddffdd; }
.highlight .gi .x {
color: #000000;
background-color: #aaffaa; }
.highlight .go {
color: #888888; }
.highlight .gp {
color: #555555; }
.highlight .gs {
font-weight: bold; }
.highlight .gu {
color: #aaaaaa; }
.highlight .gt {
color: #aa0000; }
.highlight .kc {
color: #000000;
font-weight: bold; }
.highlight .kd {
color: #000000;
font-weight: bold; }
.highlight .kp {
color: #000000;
font-weight: bold; }
.highlight .kr {
color: #000000;
font-weight: bold; }
.highlight .kt {
color: #445588; }
.highlight .m {
color: #009999; }
.highlight .s {
color: #d14; }
.highlight .na {
color: #008080; }
.highlight .nb {
color: #0086B3; }
.highlight .nc {
color: #445588;
font-weight: bold; }
.highlight .no {
color: #008080; }
.highlight .ni {
color: #800080; }
.highlight .ne {
color: #990000;
font-weight: bold; }
.highlight .nf {
color: #990000; }
.highlight .nn {
color: #555555; }
.highlight .nt {
color: #000080; }
.highlight .nv {
color: #008080; }
.highlight .ow {
color: #000000;
font-weight: bold; }
.highlight .w {
color: #bbbbbb; }
.highlight .mf {
color: #009999; }
.highlight .mh {
color: #009999; }
.highlight .mi {
color: #009999; }
.highlight .mo {
color: #009999; }
.highlight .sb {
color: #d14; }
.highlight .sc {
color: #d14; }
.highlight .sd {
color: #d14; }
.highlight .s2 {
color: #d14; }
.highlight .se {
color: #d14; }
.highlight .sh {
color: #d14; }
.highlight .si {
color: #d14; }
.highlight .sx {
color: #d14; }
.highlight .sr {
color: #009926; }
.highlight .s1 {
color: #d14; }
.highlight .ss {
color: #990073; }
.highlight .bp {
color: #999999; }
.highlight .vc {
color: #008080; }
.highlight .vg {
color: #008080; }
.highlight .vi {
color: #008080; }
.highlight .il {
color: #009999; }

View File

@ -0,0 +1,332 @@
html, body, div, span, h1, h3, h4, p, a, code, em, img, ul, li, table, tbody, tr, td {
background: transparent;
border: 0;
margin: 0;
outline: 0;
padding: 0;
vertical-align: baseline; }
body {
background-color: #f2f2f2;
font-family: Helvetica, freesans, Arial, sans-serif;
font-size: 14px;
-webkit-font-smoothing: subpixel-antialiased;
word-wrap: break-word; }
h1, h2, h3 {
margin-top: 0.8em;
margin-bottom: 0.3em;
font-weight: 100;
color: black; }
h1 {
font-size: 2.5em; }
h2 {
font-size: 2em;
border-bottom: 1px solid #e2e2e2; }
h4 {
font-size: 13px;
line-height: 1.5;
margin-top: 21px; }
h5 {
font-size: 1.1em; }
h6 {
font-size: 1.1em;
color: #777; }
.section-name {
color: gray;
display: block;
font-family: Helvetica;
font-size: 22px;
font-weight: 100;
margin-bottom: 15px; }
pre, code {
font: 0.95em Menlo, monospace;
color: #777;
word-wrap: normal; }
p code, li code {
background-color: #eee;
padding: 2px 4px;
border-radius: 4px; }
a {
color: #0088cc;
text-decoration: none; }
ul {
padding-left: 15px; }
li {
line-height: 1.8em; }
img {
max-width: 100%; }
blockquote {
margin-left: 0;
padding: 0 10px;
border-left: 4px solid #ccc; }
.content-wrapper {
margin: 0 auto;
width: 980px; }
header {
font-size: 0.85em;
line-height: 26px;
background-color: #414141;
position: fixed;
width: 100%;
z-index: 1; }
header img {
padding-right: 6px;
vertical-align: -4px;
height: 16px; }
header a {
color: #fff; }
header p {
float: left;
color: #999; }
header .header-right {
float: right;
margin-left: 16px; }
#breadcrumbs {
background-color: #f2f2f2;
height: 27px;
padding-top: 17px;
position: fixed;
width: 100%;
z-index: 1;
margin-top: 26px; }
#breadcrumbs #carat {
height: 10px;
margin: 0 5px; }
.sidebar {
background-color: #f9f9f9;
border: 1px solid #e2e2e2;
overflow-y: auto;
overflow-x: hidden;
position: fixed;
top: 70px;
bottom: 0;
width: 230px;
word-wrap: normal; }
.nav-groups {
list-style-type: none;
background: #fff;
padding-left: 0; }
.nav-group-name {
border-bottom: 1px solid #e2e2e2;
font-size: 1.1em;
font-weight: 100;
padding: 15px 0 15px 20px; }
.nav-group-name > a {
color: #333; }
.nav-group-tasks {
margin-top: 5px; }
.nav-group-task {
font-size: 0.9em;
list-style-type: none;
white-space: nowrap; }
.nav-group-task a {
color: #888; }
.main-content {
background-color: #fff;
border: 1px solid #e2e2e2;
margin-left: 246px;
position: absolute;
overflow: hidden;
padding-bottom: 60px;
top: 70px;
width: 734px; }
.main-content p, .main-content a, .main-content code, .main-content em, .main-content ul, .main-content table, .main-content blockquote {
margin-bottom: 1em; }
.main-content p {
line-height: 1.8em; }
.main-content section .section:first-child {
margin-top: 0;
padding-top: 0; }
.main-content section .task-group-section .task-group:first-of-type {
padding-top: 10px; }
.main-content section .task-group-section .task-group:first-of-type .section-name {
padding-top: 15px; }
.section {
padding: 0 25px; }
.highlight {
background-color: #eee;
padding: 10px 12px;
border: 1px solid #e2e2e2;
border-radius: 4px;
overflow-x: auto; }
.declaration .highlight {
overflow-x: initial;
padding: 0 40px 40px 0;
margin-bottom: -25px;
background-color: transparent;
border: none; }
.section-name {
margin: 0;
margin-left: 18px; }
.task-group-section {
padding-left: 6px;
border-top: 1px solid #e2e2e2; }
.task-group {
padding-top: 0px; }
.task-name-container a[name]:before {
content: "";
display: block;
padding-top: 70px;
margin: -70px 0 0; }
.item {
padding-top: 8px;
width: 100%;
list-style-type: none; }
.item a[name]:before {
content: "";
display: block;
padding-top: 70px;
margin: -70px 0 0; }
.item code {
background-color: transparent;
padding: 0; }
.item .token {
padding-left: 3px;
margin-left: 15px;
font-size: 11.9px; }
.item .declaration-note {
font-size: .85em;
color: gray;
font-style: italic; }
.pointer-container {
border-bottom: 1px solid #e2e2e2;
left: -23px;
padding-bottom: 13px;
position: relative;
width: 110%; }
.pointer {
background: #f9f9f9;
border-left: 1px solid #e2e2e2;
border-top: 1px solid #e2e2e2;
height: 12px;
left: 21px;
top: -7px;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
position: absolute;
width: 12px; }
.height-container {
display: none;
left: -25px;
padding: 0 25px;
position: relative;
width: 100%;
overflow: hidden; }
.height-container .section {
background: #f9f9f9;
border-bottom: 1px solid #e2e2e2;
left: -25px;
position: relative;
width: 100%;
padding-top: 10px;
padding-bottom: 5px; }
.aside, .language {
padding: 6px 12px;
margin: 12px 0;
border-left: 5px solid #dddddd;
overflow-y: hidden; }
.aside .aside-title, .language .aside-title {
font-size: 9px;
letter-spacing: 2px;
text-transform: uppercase;
padding-bottom: 0;
margin: 0;
color: #aaa;
-webkit-user-select: none; }
.aside p:last-child, .language p:last-child {
margin-bottom: 0; }
.language {
border-left: 5px solid #cde9f4; }
.language .aside-title {
color: #4b8afb; }
.aside-warning {
border-left: 5px solid #ff6666; }
.aside-warning .aside-title {
color: #ff0000; }
.graybox {
border-collapse: collapse;
width: 100%; }
.graybox p {
margin: 0;
word-break: break-word;
min-width: 50px; }
.graybox td {
border: 1px solid #e2e2e2;
padding: 5px 25px 5px 10px;
vertical-align: middle; }
.graybox tr td:first-of-type {
text-align: right;
padding: 7px;
vertical-align: top;
word-break: normal;
width: 40px; }
.slightly-smaller {
font-size: 0.9em; }
#footer {
position: absolute;
bottom: 10px;
margin-left: 25px; }
#footer p {
margin: 0;
color: #aaa;
font-size: 0.8em; }
html.dash header, html.dash #breadcrumbs, html.dash .sidebar {
display: none; }
html.dash .main-content {
width: 980px;
margin-left: 0;
border: none;
width: 100%;
top: 0;
padding-bottom: 0; }
html.dash .height-container {
display: block; }
html.dash .item .token {
margin-left: 0; }
html.dash .content-wrapper {
width: auto; }
html.dash #footer {
position: static; }

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -0,0 +1,181 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Gifu Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset='utf-8'>
<script src="js/jquery.min.js" defer></script>
<script src="js/jazzy.js" defer></script>
</head>
<body>
<a title="Gifu Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="index.html">Gifu Docs</a> (100% documented)</p>
<p class="header-right"><a href="https://github.com/kaishin/gifu/"><img src="img/gh.png"/>View on GitHub</a></p>
<p class="header-right"><a href="dash-feed://https%3A%2F%2Fpyroh%2Egithub%2Eio%2Fdocsets%2FGifu%2Exml"><img src="img/dash.png"/>Install in Dash</a></p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="index.html">Gifu Reference</a>
<img id="carat" src="img/carat.png" />
Gifu Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Classes/Animator.html">Animator</a>
</li>
<li class="nav-group-task">
<a href="Classes/GIFImageView.html">GIFImageView</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Protocols/GIFAnimatable.html">GIFAnimatable</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1><img src="https://github.com/kaishin/Gifu/raw/swift3/header.gif" alt="Gifu Logo" style="border-radius: 6px"></h1>
<p><a href="https://github.com/kaishin/Gifu/releases/latest"><img src="https://img.shields.io/github/release/kaishin/Gifu.svg?maxAge=2592000" alt="GitHub release"></a> <a href="https://travis-ci.org/kaishin/Gifu"><img src="https://travis-ci.org/kaishin/Gifu.svg?branch=master" alt="Travis"></a> <a href="https://github.com/Carthage/Carthage"><img src="https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat" alt="Carthage compatible"></a> <a href="https://gitter.im/kaishin/gifu"><img src="https://badges.gitter.im/kaishin/gifu.svg" alt="Join the chat at https://gitter.im/kaishin/gifu"></a> <img src="https://img.shields.io/badge/Swift-3.0.x-orange.svg" alt="Swift 3.0.x"> <img src="https://img.shields.io/badge/platforms-iOS-lightgrey.svg" alt="platforms"></p>
<p>Gifu adds protocol-based, performance-aware animated GIF support to UIKit, without forcing you to use a <code>UIImageView</code> subclass. (It&rsquo;s also a <a href="https://goo.gl/maps/CCeAc">prefecture in Japan</a>).</p>
<p><strong>Swift 2.3</strong> support is on the <a href="https://github.com/kaishin/Gifu/tree/swift2.3">swift2.3</a> branch. <strong>This branch will not be getting any future updates</strong>.</p>
<a href='#install' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='install'>Install</h2>
<a href='#a-href-https-github-com-carthage-carthage-carthage-a' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='a-href-https-github-com-carthage-carthage-carthage-a'><a href="https://github.com/Carthage/Carthage">Carthage</a></h3>
<ul>
<li>Add the following to your Cartfile: <code>github &quot;kaishin/Gifu&quot;</code></li>
<li>Then run <code>carthage update</code></li>
<li>Follow the current instructions in <a href="https://github.com/Carthage/Carthage#adding-frameworks-to-an-application">Carthage&rsquo;s README</a>
for up to date installation instructions.</li>
</ul>
<a href='#a-href-http-cocoapods-org-cocoapods-a' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='a-href-http-cocoapods-org-cocoapods-a'><a href="http://cocoapods.org">CocoaPods</a></h3>
<ul>
<li>Add the following to your <a href="http://guides.cocoapods.org/using/the-podfile.html">Podfile</a>: <code>pod &#39;Gifu&#39;</code></li>
<li>You will also need to make sure you&rsquo;re opting into using frameworks: <code>use_frameworks!</code></li>
<li>Then run <code>pod install</code> with CocoaPods 0.36 or newer.</li>
</ul>
<a href='#how-it-works' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='how-it-works'>How It Works</h2>
<p><code>Gifu</code> does not rely on subclassing <code>UIImageView</code>. The <code>Animator</code> class does the heavy-lifting, while the <code>GIFAnimatable</code> protocol exposes the functionality to the view classes that conform to it, using protocol extensions.</p>
<p>The <code>Animator</code> has a <code>FrameStore</code> that only keeps a limited number of frames in-memory, effectively creating a buffer for the animation without consuming all the available memory. This approach makes loading large GIFs a lot more resource-friendly.</p>
<p>The figure below summarizes how this works in practice. Given an image
containing 10 frames, Gifu will load the current frame (red), buffer the next two frames in this example (orange), and empty up all the other frames to free up memory (gray):</p>
<p><img src="https://db.tt/ZLfx23hg" width="300" /></p>
<a href='#usage' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='usage'>Usage</h2>
<p>There are two options that should cover any situation:</p>
<ul>
<li>Use the built-in <code>GIFImageView</code> subclass.</li>
<li>Make <code>UIImageView</code> or any of its subclasses conform to <code>GIFAnimatable</code>.</li>
</ul>
<a href='#gifimageview' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='gifimageview'>GIFImageView</h3>
<p>A subclass of <code>UIImageView</code> that conforms to <code>GIFAnimatable</code>. You can use this class as-is or subclass it for further customization (not recommended).</p>
<a href='#gifanimatable' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='gifanimatable'>GIFAnimatable</h3>
<p>The bread and butter of Gifu. Through protocol extensions, <code>GIFAnimatable</code> exposes all the APIs of the library, and with very little boilerplate, any <code>UIImageView</code> subclass can conform to it.</p>
<pre class="highlight swift"><code><span class="kd">class</span> <span class="kt">MyImageView</span><span class="p">:</span> <span class="kt">UIImageView</span><span class="p">,</span> <span class="kt">GIFAnimatable</span> <span class="p">{</span>
<span class="kd">public</span> <span class="kd">lazy</span> <span class="k">var</span> <span class="nv">animator</span><span class="p">:</span> <span class="kt">Animator</span><span class="p">?</span> <span class="o">=</span> <span class="p">{</span>
<span class="k">return</span> <span class="kt">Animator</span><span class="p">(</span><span class="nv">withDelegate</span><span class="p">:</span> <span class="k">self</span><span class="p">)</span>
<span class="p">}()</span>
<span class="k">override</span> <span class="kd">public</span> <span class="kd">func</span> <span class="nf">display</span><span class="p">(</span><span class="n">_</span> <span class="nv">layer</span><span class="p">:</span> <span class="kt">CALayer</span><span class="p">)</span> <span class="p">{</span>
<span class="nf">updateImageIfNeeded</span><span class="p">()</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre>
<p>That&rsquo;s it. Now <code>MyImageView</code> is fully GIF-compatible, and any of these methods can be called on it:</p>
<ul>
<li><code>prepareForAnimation(withGIFNamed:)</code> and <code>prepareForAnimation(withGIFData:)</code> to prepare the animator property for animation.</li>
<li><code>startAnimatingGIF()</code> and <code>stopAnimatingGIF()</code> to control the animation.</li>
<li><code>animate(withGIFNamed:)</code> and <code>animate(withGIFData:)</code> to prepare for animation and start animating immediately.</li>
<li><code>frameCount</code>, <code>isAnimatingGIF</code>, and <code>activeFrame</code> to inspect the GIF view.</li>
<li><code>prepareForReuse()</code> to free up resources.</li>
<li><code>updateImageIfNeeded()</code> to update the image property if necessary.</li>
</ul>
<a href='#examples' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='examples'>Examples</h3>
<p>The simplest way to get started is initializing a <code>GIFAnimatable</code> class in code or in a storyboard, then calling <code>animate(:)</code> on it.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">imageView</span> <span class="o">=</span> <span class="kt">GIFImageView</span><span class="p">(</span><span class="nv">frame</span><span class="p">:</span> <span class="kt">CGRect</span><span class="p">(</span><span class="nv">x</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> <span class="nv">y</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> <span class="nv">width</span><span class="p">:</span> <span class="mi">200</span><span class="p">,</span> <span class="nv">height</span><span class="p">:</span> <span class="mi">100</span><span class="p">))</span>
<span class="n">imageView</span><span class="o">.</span><span class="nf">animate</span><span class="p">(</span><span class="nv">withGIFNamed</span><span class="p">:</span> <span class="s">"mugen"</span><span class="p">)</span>
</code></pre>
<p>You can also prepare for the animation when the view loads and only start animating after a user interaction.</p>
<pre class="highlight swift"><code><span class="c1">// In your view controller..</span>
<span class="k">override</span> <span class="kd">func</span> <span class="nf">viewDidLoad</span><span class="p">()</span> <span class="p">{</span>
<span class="k">super</span><span class="o">.</span><span class="nf">viewDidLoad</span><span class="p">()</span>
<span class="n">imageView</span><span class="o">.</span><span class="nf">prepareForAnimation</span><span class="p">(</span><span class="nv">withGIFNamed</span><span class="p">:</span> <span class="s">"mugen"</span><span class="p">)</span>
<span class="p">}</span>
<span class="kd">@IBAction</span> <span class="kd">func</span> <span class="nf">toggleAnimation</span><span class="p">(</span><span class="n">_</span> <span class="nv">sender</span><span class="p">:</span> <span class="kt">AnyObject</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="n">imageView</span><span class="o">.</span><span class="n">isAnimatingGIF</span> <span class="p">{</span>
<span class="n">imageView</span><span class="o">.</span><span class="nf">stopAnimatingGIF</span><span class="p">()</span>
<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
<span class="n">imageView</span><span class="o">.</span><span class="nf">startAnimatingGIF</span><span class="p">()</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre>
<p>If you are using a <code>GIFAnimatable</code> class in a table or collection view, you can call the <code>prepareForReuse()</code> method in your cell subclass:</p>
<pre class="highlight swift"><code><span class="k">override</span> <span class="kd">func</span> <span class="nf">prepareForReuse</span><span class="p">()</span> <span class="p">{</span>
<span class="k">super</span><span class="o">.</span><span class="nf">prepareForReuse</span><span class="p">()</span>
<span class="n">imageView</span><span class="o">.</span><span class="nf">prepareForReuse</span><span class="p">()</span>
<span class="p">}</span>
</code></pre>
<a href='#demo-app' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='demo-app'>Demo App</h3>
<p>Clone or download the repository and open <code>Gifu.xcworkspace</code> to check out the demo app.</p>
<a href='#documentation' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='documentation'>Documentation</h2>
<p>See the <a href="http://kaishin.github.io/Gifu/">full API documentation</a>.</p>
<a href='#compatibility' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='compatibility'>Compatibility</h2>
<ul>
<li>iOS 9.0+</li>
<li>Swift 3.0</li>
<li>Xcode 8.0</li>
</ul>
<a href='#license' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='license'>License</h2>
<p>See LICENSE.</p>
</section>
</section>
<section id="footer">
<p>2015 © Reda Lemeden. See LICENSE for more details.</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.2</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,40 @@
window.jazzy = {'docset': false}
if (typeof window.dash != 'undefined') {
document.documentElement.className += ' dash'
window.jazzy.docset = true
}
if (navigator.userAgent.match(/xcode/i)) {
document.documentElement.className += ' xcode'
window.jazzy.docset = true
}
// On doc load, toggle the URL hash discussion if present
$(document).ready(function() {
if (!window.jazzy.docset) {
var linkToHash = $('a[href="' + window.location.hash +'"]');
linkToHash.trigger("click");
}
});
// On token click, toggle its discussion and animate token.marginLeft
$(".token").click(function(event) {
if (window.jazzy.docset) {
return;
}
var link = $(this);
var animationDuration = 300;
var tokenOffset = "15px";
var original = link.css('marginLeft') == tokenOffset;
link.animate({'margin-left':original ? "0px" : tokenOffset}, animationDuration);
$content = link.parent().parent().next();
$content.slideToggle(animationDuration);
// Keeps the document from jumping to the hash.
var href = $(this).attr('href');
if (history.pushState) {
history.pushState({}, '', href);
} else {
location.hash = href;
}
event.preventDefault();
});

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,6 @@
{
"warnings": [
],
"source_directory": "/Users/kaishin/Developer/Frameworks/Gifu"
}

BIN
docs/docsets/Gifu.tgz Normal file

Binary file not shown.

1
docs/docsets/Gifu.xml Normal file
View File

@ -0,0 +1 @@
<entry><version>1.2.1</version><url>https://pyroh.github.io/docsets/Gifu.tgz</url></entry>

BIN
docs/img/carat.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

BIN
docs/img/dash.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
docs/img/gh.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

181
docs/index.html Normal file
View File

@ -0,0 +1,181 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Gifu Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset='utf-8'>
<script src="js/jquery.min.js" defer></script>
<script src="js/jazzy.js" defer></script>
</head>
<body>
<a title="Gifu Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="index.html">Gifu Docs</a> (100% documented)</p>
<p class="header-right"><a href="https://github.com/kaishin/gifu/"><img src="img/gh.png"/>View on GitHub</a></p>
<p class="header-right"><a href="dash-feed://https%3A%2F%2Fpyroh%2Egithub%2Eio%2Fdocsets%2FGifu%2Exml"><img src="img/dash.png"/>Install in Dash</a></p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="index.html">Gifu Reference</a>
<img id="carat" src="img/carat.png" />
Gifu Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Classes/Animator.html">Animator</a>
</li>
<li class="nav-group-task">
<a href="Classes/GIFImageView.html">GIFImageView</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Protocols/GIFAnimatable.html">GIFAnimatable</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1><img src="https://github.com/kaishin/Gifu/raw/swift3/header.gif" alt="Gifu Logo" style="border-radius: 6px"></h1>
<p><a href="https://github.com/kaishin/Gifu/releases/latest"><img src="https://img.shields.io/github/release/kaishin/Gifu.svg?maxAge=2592000" alt="GitHub release"></a> <a href="https://travis-ci.org/kaishin/Gifu"><img src="https://travis-ci.org/kaishin/Gifu.svg?branch=master" alt="Travis"></a> <a href="https://github.com/Carthage/Carthage"><img src="https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat" alt="Carthage compatible"></a> <a href="https://gitter.im/kaishin/gifu"><img src="https://badges.gitter.im/kaishin/gifu.svg" alt="Join the chat at https://gitter.im/kaishin/gifu"></a> <img src="https://img.shields.io/badge/Swift-3.0.x-orange.svg" alt="Swift 3.0.x"> <img src="https://img.shields.io/badge/platforms-iOS-lightgrey.svg" alt="platforms"></p>
<p>Gifu adds protocol-based, performance-aware animated GIF support to UIKit, without forcing you to use a <code>UIImageView</code> subclass. (It&rsquo;s also a <a href="https://goo.gl/maps/CCeAc">prefecture in Japan</a>).</p>
<p><strong>Swift 2.3</strong> support is on the <a href="https://github.com/kaishin/Gifu/tree/swift2.3">swift2.3</a> branch. <strong>This branch will not be getting any future updates</strong>.</p>
<a href='#install' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='install'>Install</h2>
<a href='#a-href-https-github-com-carthage-carthage-carthage-a' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='a-href-https-github-com-carthage-carthage-carthage-a'><a href="https://github.com/Carthage/Carthage">Carthage</a></h3>
<ul>
<li>Add the following to your Cartfile: <code>github &quot;kaishin/Gifu&quot;</code></li>
<li>Then run <code>carthage update</code></li>
<li>Follow the current instructions in <a href="https://github.com/Carthage/Carthage#adding-frameworks-to-an-application">Carthage&rsquo;s README</a>
for up to date installation instructions.</li>
</ul>
<a href='#a-href-http-cocoapods-org-cocoapods-a' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='a-href-http-cocoapods-org-cocoapods-a'><a href="http://cocoapods.org">CocoaPods</a></h3>
<ul>
<li>Add the following to your <a href="http://guides.cocoapods.org/using/the-podfile.html">Podfile</a>: <code>pod &#39;Gifu&#39;</code></li>
<li>You will also need to make sure you&rsquo;re opting into using frameworks: <code>use_frameworks!</code></li>
<li>Then run <code>pod install</code> with CocoaPods 0.36 or newer.</li>
</ul>
<a href='#how-it-works' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='how-it-works'>How It Works</h2>
<p><code>Gifu</code> does not rely on subclassing <code>UIImageView</code>. The <code>Animator</code> class does the heavy-lifting, while the <code>GIFAnimatable</code> protocol exposes the functionality to the view classes that conform to it, using protocol extensions.</p>
<p>The <code>Animator</code> has a <code>FrameStore</code> that only keeps a limited number of frames in-memory, effectively creating a buffer for the animation without consuming all the available memory. This approach makes loading large GIFs a lot more resource-friendly.</p>
<p>The figure below summarizes how this works in practice. Given an image
containing 10 frames, Gifu will load the current frame (red), buffer the next two frames in this example (orange), and empty up all the other frames to free up memory (gray):</p>
<p><img src="https://db.tt/ZLfx23hg" width="300" /></p>
<a href='#usage' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='usage'>Usage</h2>
<p>There are two options that should cover any situation:</p>
<ul>
<li>Use the built-in <code>GIFImageView</code> subclass.</li>
<li>Make <code>UIImageView</code> or any of its subclasses conform to <code>GIFAnimatable</code>.</li>
</ul>
<a href='#gifimageview' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='gifimageview'>GIFImageView</h3>
<p>A subclass of <code>UIImageView</code> that conforms to <code>GIFAnimatable</code>. You can use this class as-is or subclass it for further customization (not recommended).</p>
<a href='#gifanimatable' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='gifanimatable'>GIFAnimatable</h3>
<p>The bread and butter of Gifu. Through protocol extensions, <code>GIFAnimatable</code> exposes all the APIs of the library, and with very little boilerplate, any <code>UIImageView</code> subclass can conform to it.</p>
<pre class="highlight swift"><code><span class="kd">class</span> <span class="kt">MyImageView</span><span class="p">:</span> <span class="kt">UIImageView</span><span class="p">,</span> <span class="kt">GIFAnimatable</span> <span class="p">{</span>
<span class="kd">public</span> <span class="kd">lazy</span> <span class="k">var</span> <span class="nv">animator</span><span class="p">:</span> <span class="kt">Animator</span><span class="p">?</span> <span class="o">=</span> <span class="p">{</span>
<span class="k">return</span> <span class="kt">Animator</span><span class="p">(</span><span class="nv">withDelegate</span><span class="p">:</span> <span class="k">self</span><span class="p">)</span>
<span class="p">}()</span>
<span class="k">override</span> <span class="kd">public</span> <span class="kd">func</span> <span class="nf">display</span><span class="p">(</span><span class="n">_</span> <span class="nv">layer</span><span class="p">:</span> <span class="kt">CALayer</span><span class="p">)</span> <span class="p">{</span>
<span class="nf">updateImageIfNeeded</span><span class="p">()</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre>
<p>That&rsquo;s it. Now <code>MyImageView</code> is fully GIF-compatible, and any of these methods can be called on it:</p>
<ul>
<li><code>prepareForAnimation(withGIFNamed:)</code> and <code>prepareForAnimation(withGIFData:)</code> to prepare the animator property for animation.</li>
<li><code>startAnimatingGIF()</code> and <code>stopAnimatingGIF()</code> to control the animation.</li>
<li><code>animate(withGIFNamed:)</code> and <code>animate(withGIFData:)</code> to prepare for animation and start animating immediately.</li>
<li><code>frameCount</code>, <code>isAnimatingGIF</code>, and <code>activeFrame</code> to inspect the GIF view.</li>
<li><code>prepareForReuse()</code> to free up resources.</li>
<li><code>updateImageIfNeeded()</code> to update the image property if necessary.</li>
</ul>
<a href='#examples' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='examples'>Examples</h3>
<p>The simplest way to get started is initializing a <code>GIFAnimatable</code> class in code or in a storyboard, then calling <code>animate(:)</code> on it.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">imageView</span> <span class="o">=</span> <span class="kt">GIFImageView</span><span class="p">(</span><span class="nv">frame</span><span class="p">:</span> <span class="kt">CGRect</span><span class="p">(</span><span class="nv">x</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> <span class="nv">y</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> <span class="nv">width</span><span class="p">:</span> <span class="mi">200</span><span class="p">,</span> <span class="nv">height</span><span class="p">:</span> <span class="mi">100</span><span class="p">))</span>
<span class="n">imageView</span><span class="o">.</span><span class="nf">animate</span><span class="p">(</span><span class="nv">withGIFNamed</span><span class="p">:</span> <span class="s">"mugen"</span><span class="p">)</span>
</code></pre>
<p>You can also prepare for the animation when the view loads and only start animating after a user interaction.</p>
<pre class="highlight swift"><code><span class="c1">// In your view controller..</span>
<span class="k">override</span> <span class="kd">func</span> <span class="nf">viewDidLoad</span><span class="p">()</span> <span class="p">{</span>
<span class="k">super</span><span class="o">.</span><span class="nf">viewDidLoad</span><span class="p">()</span>
<span class="n">imageView</span><span class="o">.</span><span class="nf">prepareForAnimation</span><span class="p">(</span><span class="nv">withGIFNamed</span><span class="p">:</span> <span class="s">"mugen"</span><span class="p">)</span>
<span class="p">}</span>
<span class="kd">@IBAction</span> <span class="kd">func</span> <span class="nf">toggleAnimation</span><span class="p">(</span><span class="n">_</span> <span class="nv">sender</span><span class="p">:</span> <span class="kt">AnyObject</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="n">imageView</span><span class="o">.</span><span class="n">isAnimatingGIF</span> <span class="p">{</span>
<span class="n">imageView</span><span class="o">.</span><span class="nf">stopAnimatingGIF</span><span class="p">()</span>
<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
<span class="n">imageView</span><span class="o">.</span><span class="nf">startAnimatingGIF</span><span class="p">()</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre>
<p>If you are using a <code>GIFAnimatable</code> class in a table or collection view, you can call the <code>prepareForReuse()</code> method in your cell subclass:</p>
<pre class="highlight swift"><code><span class="k">override</span> <span class="kd">func</span> <span class="nf">prepareForReuse</span><span class="p">()</span> <span class="p">{</span>
<span class="k">super</span><span class="o">.</span><span class="nf">prepareForReuse</span><span class="p">()</span>
<span class="n">imageView</span><span class="o">.</span><span class="nf">prepareForReuse</span><span class="p">()</span>
<span class="p">}</span>
</code></pre>
<a href='#demo-app' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='demo-app'>Demo App</h3>
<p>Clone or download the repository and open <code>Gifu.xcworkspace</code> to check out the demo app.</p>
<a href='#documentation' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='documentation'>Documentation</h2>
<p>See the <a href="http://kaishin.github.io/Gifu/">full API documentation</a>.</p>
<a href='#compatibility' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='compatibility'>Compatibility</h2>
<ul>
<li>iOS 9.0+</li>
<li>Swift 3.0</li>
<li>Xcode 8.0</li>
</ul>
<a href='#license' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='license'>License</h2>
<p>See LICENSE.</p>
</section>
</section>
<section id="footer">
<p>2015 © Reda Lemeden. See LICENSE for more details.</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.2</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

40
docs/js/jazzy.js Executable file
View File

@ -0,0 +1,40 @@
window.jazzy = {'docset': false}
if (typeof window.dash != 'undefined') {
document.documentElement.className += ' dash'
window.jazzy.docset = true
}
if (navigator.userAgent.match(/xcode/i)) {
document.documentElement.className += ' xcode'
window.jazzy.docset = true
}
// On doc load, toggle the URL hash discussion if present
$(document).ready(function() {
if (!window.jazzy.docset) {
var linkToHash = $('a[href="' + window.location.hash +'"]');
linkToHash.trigger("click");
}
});
// On token click, toggle its discussion and animate token.marginLeft
$(".token").click(function(event) {
if (window.jazzy.docset) {
return;
}
var link = $(this);
var animationDuration = 300;
var tokenOffset = "15px";
var original = link.css('marginLeft') == tokenOffset;
link.animate({'margin-left':original ? "0px" : tokenOffset}, animationDuration);
$content = link.parent().parent().next();
$content.slideToggle(animationDuration);
// Keeps the document from jumping to the hash.
var href = $(this).attr('href');
if (history.pushState) {
history.pushState({}, '', href);
} else {
location.hash = href;
}
event.preventDefault();
});

4
docs/js/jquery.min.js vendored Executable file

File diff suppressed because one or more lines are too long

6
docs/undocumented.json Normal file
View File

@ -0,0 +1,6 @@
{
"warnings": [
],
"source_directory": "/Users/kaishin/Developer/Frameworks/Gifu"
}

BIN
header.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 KiB