text: <!DOCTYPE html>
  <html lang="en">
    <head>
      <title>AsyncAction 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/AsyncAction" class="dashAnchor"></a>
      <a title="AsyncAction Protocol Reference"></a>
      <header>
        <div class="content-wrapper">
          <p><a href="../index.html">Katana Docs</a> (99% documented)</p>
          <p class="header-right"><a href="https://github.com/BendingSpoons/katana-swift"><img src="../img/gh.png"/>View on GitHub</a></p>
        </div>
      </header>
      <div class="content-wrapper">
        <p id="breadcrumbs">
          <a href="../index.html">Katana Reference</a>
          <img id="carat" src="../img/carat.png" />
          AsyncAction 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/EmptySideEffectDependencyContainer.html">EmptySideEffectDependencyContainer</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Classes/Node.html">Node</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Classes/PlasticNode.html">PlasticNode</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Classes/PlasticView.html">PlasticView</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Classes/Renderer.html">Renderer</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Classes/StateMockProvider.html">StateMockProvider</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Classes/Store.html">Store</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Classes/ViewsContainer.html">ViewsContainer</a>
                </li>
              </ul>
            </li>
            <li class="nav-group-name">
              <a href="../Enums.html">Enums</a>
              <ul class="nav-group-tasks">
                <li class="nav-group-task">
                  <a href="../Enums/AnimationType.html">AnimationType</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Enums/AsyncActionState.html">AsyncActionState</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Enums.html#/s:O6Katana9EmptyKeys">EmptyKeys</a>
                </li>
              </ul>
            </li>
            <li class="nav-group-name">
              <a href="../Extensions.html">Extensions</a>
              <ul class="nav-group-tasks">
                <li class="nav-group-task">
                  <a href="../Extensions/Array.html">Array</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Extensions/CGSize.html">CGSize</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Extensions/UIView.html">UIView</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/Action.html">Action</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Protocols/ActionWithSideEffect.html">ActionWithSideEffect</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Protocols/AnyAsyncAction.html">AnyAsyncAction</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Protocols/AnyConnectedNodeDescription.html">AnyConnectedNodeDescription</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Protocols/AnyNode.html">AnyNode</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Protocols/AnyNodeDescription.html">AnyNodeDescription</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Protocols/AnyNodeDescriptionProps.html">AnyNodeDescriptionProps</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Protocols/AnyNodeDescriptionWithChildren.html">AnyNodeDescriptionWithChildren</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Protocols/AnyNodeDescriptionWithRefProps.html">AnyNodeDescriptionWithRefProps</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Protocols/AnyPlasticNodeDescription.html">AnyPlasticNodeDescription</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Protocols/AnyPlatformNativeViewWithRef.html">AnyPlatformNativeViewWithRef</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Protocols/AnyStore.html">AnyStore</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Protocols/AsyncAction.html">AsyncAction</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Protocols/Childrenable.html">Childrenable</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Protocols/ConnectedNodeDescription.html">ConnectedNodeDescription</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Protocols/LinkeableAction.html">LinkeableAction</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Protocols/NativeViewRef.html">NativeViewRef</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Protocols/NativeViewWithRef.html">NativeViewWithRef</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Protocols/NodeDescription.html">NodeDescription</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Protocols/NodeDescriptionProps.html">NodeDescriptionProps</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Protocols/NodeDescriptionState.html">NodeDescriptionState</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Protocols/NodeDescriptionWithChildren.html">NodeDescriptionWithChildren</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Protocols.html#/s:P6Katana22NodeDescriptionWithRef">NodeDescriptionWithRef</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Protocols/NodeDescriptionWithRefProps.html">NodeDescriptionWithRefProps</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Protocols/PlasticNodeDescription.html">PlasticNodeDescription</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Protocols/PlasticReferenceSizeable.html">PlasticReferenceSizeable</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Protocols/PlatformNativeView.html">PlatformNativeView</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Protocols/SideEffectDependencyContainer.html">SideEffectDependencyContainer</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Protocols/State.html">State</a>
                </li>
              </ul>
            </li>
            <li class="nav-group-name">
              <a href="../Structs.html">Structs</a>
              <ul class="nav-group-tasks">
                <li class="nav-group-task">
                  <a href="../Structs/ActionLinker.html">ActionLinker</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Structs/ActionLinks.html">ActionLinks</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Structs/Anchor.html">Anchor</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Structs/Anchor/Kind.html">– Kind</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Structs/Animation.html">Animation</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Structs/AnimationContainer.html">AnimationContainer</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Structs/AnimationOptions.html">AnimationOptions</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Structs/AnimationProps.html">AnimationProps</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Structs/ChildrenAnimations.html">ChildrenAnimations</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Structs/EdgeInsets.html">EdgeInsets</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Structs/EmptyProps.html">EmptyProps</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Structs/EmptyState.html">EmptyState</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Structs/Size.html">Size</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Structs/Value.html">Value</a>
                </li>
              </ul>
            </li>
            <li class="nav-group-name">
              <a href="../Typealiases.html">Typealiases</a>
              <ul class="nav-group-tasks">
                <li class="nav-group-task">
                  <a href="../Typealiases.html#/s:6Katana25AnimationPropsTransformer">AnimationPropsTransformer</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Typealiases.html#/s:6Katana21AnyRefCallbackClosure">AnyRefCallbackClosure</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Typealiases.html#/s:6Katana20NodeUpdateCompletion">NodeUpdateCompletion</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Typealiases.html#/s:6Katana18RefCallbackClosure">RefCallbackClosure</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Typealiases.html#/s:6Katana13StoreDispatch">StoreDispatch</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Typealiases.html#/s:6Katana13StoreListener">StoreListener</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Typealiases.html#/s:6Katana15StoreMiddleware">StoreMiddleware</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Typealiases.html#/s:6Katana16StoreUnsubscribe">StoreUnsubscribe</a>
                </li>
              </ul>
            </li>
            <li class="nav-group-name">
              <a href="../Associated Types.html">Associated Types</a>
              <ul class="nav-group-tasks">
                <li class="nav-group-task">
                  <a href="../Associated Types.html#/s:P6Katana27NodeDescriptionWithChildren9PropsType">PropsType</a>
                </li>
              </ul>
            </li>
          </ul>
        </nav>
        <article class="main-content">
          <section>
            <section class="section">
              <h1>AsyncAction</h1>
                <div class="declaration">
                  <div class="language">
                    <pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">AsyncAction</span><span class="p">:</span> <span class="kt"><a href="../Protocols/Action.html">Action</a></span><span class="p">,</span> <span class="kt"><a href="../Protocols/AnyAsyncAction.html">AnyAsyncAction</a></span></code></pre>
  
                  </div>
                </div>
              <p>Protocol that represents an <code>async</code> action.</p>
  
  <p>An <code>AsyncAction</code> is just an abstraction over <code><a href="../Protocols/Action.html">Action</a></code> that provides a way to structure
  your action.</p>
  
  <p>You typically use an <code>Async</code> action when you have to deal with operations that are asynchronous.
  In the most common scenario, you dispatch the initial action, execute an operation in the side effect 
  and then dispatch a completed/failed action based on the result of the operation. If the action has a concept
  of progress, you can also dispatch progress actions.</p>
  
  <p>This protocol has as the main goal to standardize the way async actions are managed.</p>
  
  <p>It is important to note that this is just a a convenience approach to something you can do anyway.
  You can for instance create three actions: <code>performOperation</code>, <code>OperationCompleted</code> and <code>OperationFailed</code> and achieve
  the same result. <code>AsyncAction</code> just provide a way to abstract and simplify the process</p>
  
  <p><a href='#tip-amp-tricks' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='tip-amp-tricks'>Tip &amp; Tricks</h4></p>
  
  <p>Since the <code><a href="../Protocols/Action.html">Action</a></code> protocol is very generic when it comes to the state type that should be updated, a pattern
  we want to promote is to put in your application a protocol like the following:</p>
  
  <pre class="highlight plaintext"><code>protocol AppSyncAction: AsyncAction {
   func updatedStateForLoading(currentState: inout AppState)
   // same for completed, failed and progress
  }
  
  extension AppSyncAction {
   func updatedStateForLoading(currentState: State) -&gt; State {
     guard var state = state as? AppState else {
       fatalError("Something went wrong")
     }
  
     self.updatedStateForLoading(currentState: &amp;state)
     return state
   }
  
   // same for completed, failed and progress
  }
  </code></pre>
  
  <p>In this way you can save a lot of code since you can use your actions in the following way</p>
  
  <pre class="highlight plaintext"><code>struct A: AppAsyncAction {
   func updatedStateForLoading(currentState: inout AppState) {
     state.props = action.payload
   }
  
   // same for completed, failed and progress
  }
  </code></pre>
  
            </section>
            <section class="section task-group-section">
              <div class="task-group">
                <ul>
                  <li class="item">
                    <div>
                      <code>
                      <a name="/s:FP6Katana11AsyncAction22updatedStateForLoadingFT12currentStatePS_5State__PS1__"></a>
                      <a name="//apple_ref/swift/Method/updatedStateForLoading(currentState:)" class="dashAnchor"></a>
                      <a class="token" href="#/s:FP6Katana11AsyncAction22updatedStateForLoadingFT12currentStatePS_5State__PS1__">updatedStateForLoading(currentState:)</a>
                      </code>
                    </div>
                    <div class="height-container">
                      <div class="pointer-container"></div>
                      <section class="section">
                        <div class="pointer"></div>
                        <div class="abstract">
                          <p>UpdateState function that will be used when the state of the action is <code>loading</code></p>
  
                        </div>
                        <div class="declaration">
                          <h4>Declaration</h4>
                          <div class="language">
                            <p class="aside-title">Swift</p>
                            <pre class="highlight"><code><span class="kd">func</span> <span class="nf">updatedStateForLoading</span><span class="p">(</span><span class="nv">currentState</span><span class="p">:</span> <span class="kt"><a href="../Protocols/State.html">State</a></span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt"><a href="../Protocols/State.html">State</a></span></code></pre>
  
                          </div>
                        </div>
                        <div>
                          <h4>Parameters</h4>
                          <table class="graybox">
                            <tbody>
                              <tr>
                                <td>
                                  <code>
                                  <em>state</em>
                                  </code>
                                </td>
                                <td>
                                  <div>
                                    <p>the current state of the application</p>
  
                                  </div>
                                </td>
                              </tr>
                            </tbody>
                          </table>
                        </div>
                        <div>
                          <h4>Return Value</h4>
                          <p>the new state</p>
  
                        </div>
                        <div class="slightly-smaller">
                          <a href="https://github.com/BendingSpoons/katana-swift/tree/0.8.7/Katana/Store/AsyncAction.swift#L124">Show on GitHub</a>
                        </div>
                      </section>
                    </div>
                  </li>
                  <li class="item">
                    <div>
                      <code>
                      <a name="/s:FP6Katana11AsyncAction24updatedStateForCompletedFT12currentStatePS_5State__PS1__"></a>
                      <a name="//apple_ref/swift/Method/updatedStateForCompleted(currentState:)" class="dashAnchor"></a>
                      <a class="token" href="#/s:FP6Katana11AsyncAction24updatedStateForCompletedFT12currentStatePS_5State__PS1__">updatedStateForCompleted(currentState:)</a>
                      </code>
                    </div>
                    <div class="height-container">
                      <div class="pointer-container"></div>
                      <section class="section">
                        <div class="pointer"></div>
                        <div class="abstract">
                          <p>UpdateState function that will be used when the state of the action is <code>completed</code></p>
  
                        </div>
                        <div class="declaration">
                          <h4>Declaration</h4>
                          <div class="language">
                            <p class="aside-title">Swift</p>
                            <pre class="highlight"><code><span class="kd">func</span> <span class="nf">updatedStateForCompleted</span><span class="p">(</span><span class="nv">currentState</span><span class="p">:</span> <span class="kt"><a href="../Protocols/State.html">State</a></span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt"><a href="../Protocols/State.html">State</a></span></code></pre>
  
                          </div>
                        </div>
                        <div>
                          <h4>Parameters</h4>
                          <table class="graybox">
                            <tbody>
                              <tr>
                                <td>
                                  <code>
                                  <em>state</em>
                                  </code>
                                </td>
                                <td>
                                  <div>
                                    <p>the current state of the application</p>
  
                                  </div>
                                </td>
                              </tr>
                            </tbody>
                          </table>
                        </div>
                        <div>
                          <h4>Return Value</h4>
                          <p>the new state</p>
  
                        </div>
                        <div class="slightly-smaller">
                          <a href="https://github.com/BendingSpoons/katana-swift/tree/0.8.7/Katana/Store/AsyncAction.swift#L132">Show on GitHub</a>
                        </div>
                      </section>
                    </div>
                  </li>
                  <li class="item">
                    <div>
                      <code>
                      <a name="/s:FP6Katana11AsyncAction21updatedStateForFailedFT12currentStatePS_5State__PS1__"></a>
                      <a name="//apple_ref/swift/Method/updatedStateForFailed(currentState:)" class="dashAnchor"></a>
                      <a class="token" href="#/s:FP6Katana11AsyncAction21updatedStateForFailedFT12currentStatePS_5State__PS1__">updatedStateForFailed(currentState:)</a>
                      </code>
                    </div>
                    <div class="height-container">
                      <div class="pointer-container"></div>
                      <section class="section">
                        <div class="pointer"></div>
                        <div class="abstract">
                          <p>UpdateState function that will be used when the state of the action is <code>failed</code></p>
  
                        </div>
                        <div class="declaration">
                          <h4>Declaration</h4>
                          <div class="language">
                            <p class="aside-title">Swift</p>
                            <pre class="highlight"><code><span class="kd">func</span> <span class="nf">updatedStateForFailed</span><span class="p">(</span><span class="nv">currentState</span><span class="p">:</span> <span class="kt"><a href="../Protocols/State.html">State</a></span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt"><a href="../Protocols/State.html">State</a></span></code></pre>
  
                          </div>
                        </div>
                        <div>
                          <h4>Parameters</h4>
                          <table class="graybox">
                            <tbody>
                              <tr>
                                <td>
                                  <code>
                                  <em>state</em>
                                  </code>
                                </td>
                                <td>
                                  <div>
                                    <p>the current state of the application</p>
  
                                  </div>
                                </td>
                              </tr>
                            </tbody>
                          </table>
                        </div>
                        <div>
                          <h4>Return Value</h4>
                          <p>the new state</p>
  
                        </div>
                        <div class="slightly-smaller">
                          <a href="https://github.com/BendingSpoons/katana-swift/tree/0.8.7/Katana/Store/AsyncAction.swift#L140">Show on GitHub</a>
                        </div>
                      </section>
                    </div>
                  </li>
                  <li class="item">
                    <div>
                      <code>
                      <a name="/s:FP6Katana11AsyncAction23updatedStateForProgressFT12currentStatePS_5State__PS1__"></a>
                      <a name="//apple_ref/swift/Method/updatedStateForProgress(currentState:)" class="dashAnchor"></a>
                      <a class="token" href="#/s:FP6Katana11AsyncAction23updatedStateForProgressFT12currentStatePS_5State__PS1__">updatedStateForProgress(currentState:)</a>
                      </code>
                    </div>
                    <div class="height-container">
                      <div class="pointer-container"></div>
                      <section class="section">
                        <div class="pointer"></div>
                        <div class="abstract">
                          <p>UpdateState function that will be used when the state of the action is <code>progress</code></p>
  
                        </div>
                        <div class="declaration">
                          <h4>Declaration</h4>
                          <div class="language">
                            <p class="aside-title">Swift</p>
                            <pre class="highlight"><code><span class="kd">func</span> <span class="nf">updatedStateForProgress</span><span class="p">(</span><span class="nv">currentState</span><span class="p">:</span> <span class="kt"><a href="../Protocols/State.html">State</a></span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt"><a href="../Protocols/State.html">State</a></span></code></pre>
  
                          </div>
                        </div>
                        <div>
                          <h4>Parameters</h4>
                          <table class="graybox">
                            <tbody>
                              <tr>
                                <td>
                                  <code>
                                  <em>state</em>
                                  </code>
                                </td>
                                <td>
                                  <div>
                                    <p>the current state of the application</p>
  
                                  </div>
                                </td>
                              </tr>
                            </tbody>
                          </table>
                        </div>
                        <div>
                          <h4>Return Value</h4>
                          <p>the new state</p>
  
                        </div>
                        <div class="slightly-smaller">
                          <a href="https://github.com/BendingSpoons/katana-swift/tree/0.8.7/Katana/Store/AsyncAction.swift#L148">Show on GitHub</a>
                        </div>
                      </section>
                    </div>
                  </li>
                  <li class="item">
                    <div>
                      <code>
                      <a name="/s:FP6Katana11AsyncAction15completedActionFFRxT_x"></a>
                      <a name="//apple_ref/swift/Method/completedAction(_:)" class="dashAnchor"></a>
                      <a class="token" href="#/s:FP6Katana11AsyncAction15completedActionFFRxT_x">completedAction(_:)</a>
                      </code>
                        <span class="declaration-note">
                          Default implementation
                        </span>
                    </div>
                    <div class="height-container">
                      <div class="pointer-container"></div>
                      <section class="section">
                        <div class="pointer"></div>
                        <div class="abstract">
                          <p>Creates a new action in the <code>completed</code> state</p>
  
                        </div>
                        <h4>Default Implementation</h4>
                        <div class="default_impl abstract">
                          <p>Creates a new action in the <code>completed</code> state</p>
  
                        </div>
                        <div class="declaration">
                          <h4>Declaration</h4>
                          <div class="language">
                            <p class="aside-title">Swift</p>
                            <pre class="highlight"><code><span class="kd">func</span> <span class="nf">completedAction</span><span class="p">(</span><span class="n">_</span> <span class="nv">configuration</span><span class="p">:</span> <span class="p">(</span><span class="k">inout</span> <span class="k">Self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="p">())</span> <span class="o">-&gt;</span> <span class="k">Self</span></code></pre>
  
                          </div>
                        </div>
                        <div>
                          <h4>Parameters</h4>
                          <table class="graybox">
                            <tbody>
                              <tr>
                                <td>
                                  <code>
                                  <em>configuration</em>
                                  </code>
                                </td>
                                <td>
                                  <div>
                                    <p>a block that updates the loading action with the information of the completion</p>
  
                                  </div>
                                </td>
                              </tr>
                            </tbody>
                          </table>
                        </div>
                        <div>
                          <h4>Return Value</h4>
                          <p>a new instance of the action, where the state is <code>completed</code>. This new action will have the loading payload inerithed from the initial loading action and the provided additional information</p>
  
                        </div>
                        <div class="slightly-smaller">
                          <a href="https://github.com/BendingSpoons/katana-swift/tree/0.8.7/Katana/Store/AsyncAction.swift#L159">Show on GitHub</a>
                        </div>
                      </section>
                    </div>
                  </li>
                  <li class="item">
                    <div>
                      <code>
                      <a name="/s:FP6Katana11AsyncAction12failedActionFFRxT_x"></a>
                      <a name="//apple_ref/swift/Method/failedAction(_:)" class="dashAnchor"></a>
                      <a class="token" href="#/s:FP6Katana11AsyncAction12failedActionFFRxT_x">failedAction(_:)</a>
                      </code>
                        <span class="declaration-note">
                          Default implementation
                        </span>
                    </div>
                    <div class="height-container">
                      <div class="pointer-container"></div>
                      <section class="section">
                        <div class="pointer"></div>
                        <div class="abstract">
                          <p>Creates a new action in the <code>failed</code> state</p>
  
                        </div>
                        <h4>Default Implementation</h4>
                        <div class="default_impl abstract">
                          <p>Creates a new action in the <code>failed</code> state</p>
  
                        </div>
                        <div class="declaration">
                          <h4>Declaration</h4>
                          <div class="language">
                            <p class="aside-title">Swift</p>
                            <pre class="highlight"><code><span class="kd">func</span> <span class="nf">failedAction</span><span class="p">(</span><span class="n">_</span> <span class="nv">configuration</span><span class="p">:</span> <span class="p">(</span><span class="k">inout</span> <span class="k">Self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="p">())</span> <span class="o">-&gt;</span> <span class="k">Self</span></code></pre>
  
                          </div>
                        </div>
                        <div>
                          <h4>Parameters</h4>
                          <table class="graybox">
                            <tbody>
                              <tr>
                                <td>
                                  <code>
                                  <em>configuration</em>
                                  </code>
                                </td>
                                <td>
                                  <div>
                                    <p>a block that updates the loading action with the information of the failure</p>
  
                                  </div>
                                </td>
                              </tr>
                            </tbody>
                          </table>
                        </div>
                        <div>
                          <h4>Return Value</h4>
                          <p>a new instance of the action, where the state is <code>failed</code>. This new action will have the loading payload inerithed from the initial loading action and the provided additional information</p>
  
                        </div>
                        <div class="slightly-smaller">
                          <a href="https://github.com/BendingSpoons/katana-swift/tree/0.8.7/Katana/Store/AsyncAction.swift#L170">Show on GitHub</a>
                        </div>
                      </section>
                    </div>
                  </li>
                  <li class="item">
                    <div>
                      <code>
                      <a name="/s:FP6Katana11AsyncAction14progressActionFT10percentageSd_x"></a>
                      <a name="//apple_ref/swift/Method/progressAction(percentage:)" class="dashAnchor"></a>
                      <a class="token" href="#/s:FP6Katana11AsyncAction14progressActionFT10percentageSd_x">progressAction(percentage:)</a>
                      </code>
                        <span class="declaration-note">
                          Default implementation
                        </span>
                    </div>
                    <div class="height-container">
                      <div class="pointer-container"></div>
                      <section class="section">
                        <div class="pointer"></div>
                        <div class="abstract">
                          <p>Creates a new action in the <code>progress</code> state</p>
  
                        </div>
                        <h4>Default Implementation</h4>
                        <div class="default_impl abstract">
                          <p>Creates a new action in the <code>progress</code> state</p>
  
                        </div>
                        <div class="declaration">
                          <h4>Declaration</h4>
                          <div class="language">
                            <p class="aside-title">Swift</p>
                            <pre class="highlight"><code><span class="kd">func</span> <span class="nf">progressAction</span><span class="p">(</span><span class="nv">percentage</span><span class="p">:</span> <span class="kt">Double</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="k">Self</span></code></pre>
  
                          </div>
                        </div>
                        <div>
                          <h4>Parameters</h4>
                          <table class="graybox">
                            <tbody>
                              <tr>
                                <td>
                                  <code>
                                  <em>progress</em>
                                  </code>
                                </td>
                                <td>
                                  <div>
                                    <p>the progress amount to set</p>
  
                                  </div>
                                </td>
                              </tr>
                            </tbody>
                          </table>
                        </div>
                        <div>
                          <h4>Return Value</h4>
                          <p>a new instance of the action, where the state is <code>progress</code>. This new action will have the loading payload inerithed from the initial loading action and the defined progress value</p>
  
                        </div>
                        <div class="slightly-smaller">
                          <a href="https://github.com/BendingSpoons/katana-swift/tree/0.8.7/Katana/Store/AsyncAction.swift#L181">Show on GitHub</a>
                        </div>
                      </section>
                    </div>
                  </li>
                </ul>
              </div>
              <div class="task-group">
                <ul>
                  <li class="item">
                    <div>
                      <code>
                      <a name="/s:FE6KatanaPS_11AsyncAction12updatedStateFT12currentStatePS_5State__PS1__"></a>
                      <a name="//apple_ref/swift/Method/updatedState(currentState:)" class="dashAnchor"></a>
                      <a class="token" href="#/s:FE6KatanaPS_11AsyncAction12updatedStateFT12currentStatePS_5State__PS1__">updatedState(currentState:)</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>Creates a new state starting from the current state and the dispatched action.
  <code>AsyncAction</code> implements a default behaviour that invokes 
  <code><a href="../Protocols/AsyncAction.html#/s:FP6Katana11AsyncAction22updatedStateForLoadingFT12currentStatePS_5State__PS1__">updatedStateForLoading(currentState:)</a></code>, <code><a href="../Protocols/AsyncAction.html#/s:FP6Katana11AsyncAction24updatedStateForCompletedFT12currentStatePS_5State__PS1__">updatedStateForCompleted(currentState:)</a></code>,
  <code><a href="../Protocols/AsyncAction.html#/s:FP6Katana11AsyncAction21updatedStateForFailedFT12currentStatePS_5State__PS1__">updatedStateForFailed(currentState:)</a></code> or <code>updateStateForProgress(currentState:)</code> based on the action&rsquo;s state</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">updatedState</span><span class="p">(</span><span class="nv">currentState</span><span class="p">:</span> <span class="kt"><a href="../Protocols/State.html">State</a></span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt"><a href="../Protocols/State.html">State</a></span></code></pre>
  
                          </div>
                        </div>
                        <div>
                          <h4>Parameters</h4>
                          <table class="graybox">
                            <tbody>
                              <tr>
                                <td>
                                  <code>
                                  <em>state</em>
                                  </code>
                                </td>
                                <td>
                                  <div>
                                    <p>the current state</p>
  
                                  </div>
                                </td>
                              </tr>
                            </tbody>
                          </table>
                        </div>
                        <div>
                          <h4>Return Value</h4>
                          <p>the new state</p>
  
                        </div>
                        <div class="slightly-smaller">
                          <a href="https://github.com/BendingSpoons/katana-swift/tree/0.8.7/Katana/Store/AsyncAction.swift#L194-L208">Show on GitHub</a>
                        </div>
                      </section>
                    </div>
                  </li>
                </ul>
              </div>
            </section>
          </section>
          <section id="footer">
            <p>&copy; 2017 <a class="link" href="http://bendingspoons.com" target="_blank" rel="external">Bending Spoons Team</a>. All rights reserved. (Last updated: 2017-07-18)</p>
            <p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.4</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
          </section>
        </article>
      </div>
    </body>
  </div>
  </html>
  