<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Types  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/Section/Types" class="dashAnchor"></a>
    <a title="Types  Reference"></a>
    <header>
      <div class="content-wrapper">
        <p><a href="index.html">SwiftyMocky Docs</a> (95% documented)</p>
        <p class="header-right"><a href="https://github.com/MakeAWishFoundation/SwiftyMocky"><img src="img/gh.png"/>View on GitHub</a></p>
      </div>
    </header>
    <div class="content-wrapper">
      <p id="breadcrumbs">
        <a href="index.html">SwiftyMocky Reference</a>
        <img id="carat" src="img/carat.png" />
        Types  Reference
      </p>
    </div>
    <div class="content-wrapper">
      <nav class="sidebar">
        <ul class="nav-groups">
          <li class="nav-group-name">
            <a href="Guides.html">Guides</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="overview.html">Overview</a>
              </li>
              <li class="nav-group-task">
                <a href="supported-features.html">Supported features</a>
              </li>
              <li class="nav-group-task">
                <a href="installation.html">Installation</a>
              </li>
              <li class="nav-group-task">
                <a href="setup-in-project.html">Setup in project</a>
              </li>
              <li class="nav-group-task">
                <a href="matcher-support-for-not-equatable.html">Matcher support for not Equatable</a>
              </li>
              <li class="nav-group-task">
                <a href="handling-generics.html">Handling Generics</a>
              </li>
              <li class="nav-group-task">
                <a href="examples.html">Examples</a>
              </li>
              <li class="nav-group-task">
                <a href="custom-subspec.html">Custom Subspec</a>
              </li>
              <li class="nav-group-task">
                <a href="add-xcode-generate-action.html">Add XCode generate action</a>
              </li>
              <li class="nav-group-task">
                <a href="known-issues.html">Known issues</a>
              </li>
              <li class="nav-group-task">
                <a href="changelog.html">CHANGELOG</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Global methods.html">Global methods</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Global methods.html#/s:11SwiftyMocky5Givenyyx_ABQzAA14StubbingPolicyOtAA4MockRzlF">Given(_:_:_:)</a>
              </li>
              <li class="nav-group-task">
                <a href="Global methods.html#/s:11SwiftyMocky5Givenyyxm_06StaticC0QzAA14StubbingPolicyOtAA0D4MockRzlF">Given(_:_:_:)</a>
              </li>
              <li class="nav-group-task">
                <a href="Global methods.html#/s:11SwiftyMocky7Performyyx_ABQztAA4MockRzlF">Perform(_:_:)</a>
              </li>
              <li class="nav-group-task">
                <a href="Global methods.html#/s:11SwiftyMocky7Performyyxm_06StaticC0QztAA0D4MockRzlF">Perform(_:_:)</a>
              </li>
              <li class="nav-group-task">
                <a href="Global methods.html#/s:11SwiftyMocky6Verify__4file4lineyx_ABQzs12StaticStringVSutAA4MockRzlF">Verify(_:_:file:line:)</a>
              </li>
              <li class="nav-group-task">
                <a href="Global methods.html#/s:11SwiftyMocky6Verify__4file4lineyxm_06StaticC0Qzs0F6StringVSutAA0F4MockRzlF">Verify(_:_:file:line:)</a>
              </li>
              <li class="nav-group-task">
                <a href="Global methods.html#/s:11SwiftyMocky6Verify___4file4lineyx_AA5CountVABQzs12StaticStringVSutAA4MockRzlF">Verify(_:_:_:file:line:)</a>
              </li>
              <li class="nav-group-task">
                <a href="Global methods.html#/s:11SwiftyMocky6Verify___4file4lineyxm_AA5CountV06StaticC0Qzs0G6StringVSutAA0G4MockRzlF">Verify(_:_:_:file:line:)</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Configuration.html">Configuration</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Enums/StubbingPolicy.html">StubbingPolicy</a>
              </li>
              <li class="nav-group-task">
                <a href="Enums/SequencingPolicy.html">SequencingPolicy</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Types.html">Types</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Protocols/Mock.html">Mock</a>
              </li>
              <li class="nav-group-task">
                <a href="Protocols/StaticMock.html">StaticMock</a>
              </li>
              <li class="nav-group-task">
                <a href="Enums/Parameter.html">Parameter</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/Matcher.html">Matcher</a>
              </li>
              <li class="nav-group-task">
                <a href="Protocols/Countable.html">Countable</a>
              </li>
              <li class="nav-group-task">
                <a href="Structs/Count.html">Count</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Generics.html">Generics</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Structs/GenericAttribute.html">GenericAttribute</a>
              </li>
              <li class="nav-group-task">
                <a href="Protocols/GenericAttributeType.html">GenericAttributeType</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Deprecated.html">Deprecated</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Deprecated.html#/s:11SwiftyMocky14VerifyProperty__4file4lineyx_0C0Qzs12StaticStringVSutAA4MockRzlF">VerifyProperty(_:_:file:line:)</a>
              </li>
              <li class="nav-group-task">
                <a href="Deprecated.html#/s:11SwiftyMocky14VerifyProperty__4file4lineyxm_06StaticC0Qzs0G6StringVSutAA0G4MockRzlF">VerifyProperty(_:_:file:line:)</a>
              </li>
              <li class="nav-group-task">
                <a href="Deprecated.html#/s:11SwiftyMocky14VerifyProperty___4file4lineyx_AA5CountV0C0Qzs12StaticStringVSutAA4MockRzlF">VerifyProperty(_:_:_:file:line:)</a>
              </li>
              <li class="nav-group-task">
                <a href="Deprecated.html#/s:11SwiftyMocky14VerifyProperty___4file4lineyxm_AA5CountV06StaticC0Qzs0H6StringVSutAA0H4MockRzlF">VerifyProperty(_:_:_:file:line:)</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Other Guides.html">Other Guides</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="contents.html">Contents</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Other Classes.html">Other Classes</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Classes/StubbedMethod.html">StubbedMethod</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/SwiftyMockyTestObserver.html">SwiftyMockyTestObserver</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/SwiftyMockyTestObserver.html">SwiftyMockyTestObserver</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Other Enums.html">Other Enumerations</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Other Enums.html#/s:11SwiftyMocky9MockErrorO">MockError</a>
              </li>
              <li class="nav-group-task">
                <a href="Enums/Product.html">Product</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Other Extensions.html">Other Extensions</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Extensions/Int.html">Int</a>
              </li>
              <li class="nav-group-task">
                <a href="Extensions/Optional.html">Optional</a>
              </li>
              <li class="nav-group-task">
                <a href="Extensions/UInt.html">UInt</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Other Functions.html">Other Functions</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Other Functions.html#/s:11SwiftyMocky7Failureys5NeverOSSF">Failure(_:)</a>
              </li>
              <li class="nav-group-task">
                <a href="Other Functions.html#/s:11SwiftyMocky20XCTAssertThrowsError_5error_4file4lineyxyKXK_q_SSyXKs12StaticStringVSutSQR_s0E0R_r0_lF">XCTAssertThrowsError(_:error:_:file:line:)</a>
              </li>
              <li class="nav-group-task">
                <a href="Other Functions.html#/s:11SwiftyMocky20XCTAssertThrowsError_2of_4file4lineyxyKXK_q_mSSyXKs12StaticStringVSuts0E0R_r0_lF">XCTAssertThrowsError(_:of:_:file:line:)</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Other Protocols.html">Other Protocols</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Protocols/WithSequencingPolicy.html">WithSequencingPolicy</a>
              </li>
              <li class="nav-group-task">
                <a href="Protocols/WithStaticSequencingPolicy.html">WithStaticSequencingPolicy</a>
              </li>
              <li class="nav-group-task">
                <a href="Protocols/WithStubbingPolicy.html">WithStubbingPolicy</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Other Structs.html">Other Structures</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Structs/FatalErrorUtil.html">FatalErrorUtil</a>
              </li>
              <li class="nav-group-task">
                <a href="Structs/Stubber.html">Stubber</a>
              </li>
              <li class="nav-group-task">
                <a href="Structs/StubberThrows.html">StubberThrows</a>
              </li>
            </ul>
          </li>
        </ul>
      </nav>
      <article class="main-content">
        <section>
          <section class="section">
            <h1>Types</h1>
            
          </section>
          <section class="section task-group-section">
            <div class="task-group">
              <ul>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:11SwiftyMocky4MockP"></a>
                    <a name="//apple_ref/swift/Protocol/Mock" class="dashAnchor"></a>
                    <a class="token" href="#/s:11SwiftyMocky4MockP">Mock</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Every generated mock implementation adopts <strong>Mock</strong> protocol.
It defines base Mock structure and features.</p>

                        <a href="Protocols/Mock.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 swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">Mock</span> <span class="p">:</span> <span class="kt">AnyObject</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:11SwiftyMocky10StaticMockP"></a>
                    <a name="//apple_ref/swift/Protocol/StaticMock" class="dashAnchor"></a>
                    <a class="token" href="#/s:11SwiftyMocky10StaticMockP">StaticMock</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Every mock, that stubs static methods, should adopt <strong>StaticMock</strong> protocol.
It defines base StaticMock structure and features.</p>

                        <a href="Protocols/StaticMock.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 swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">StaticMock</span> <span class="p">:</span> <span class="kt">AnyObject</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
              </ul>
            </div>
            <div class="task-group">
              <ul>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:11SwiftyMocky9ParameterO"></a>
                    <a name="//apple_ref/swift/Enum/Parameter" class="dashAnchor"></a>
                    <a class="token" href="#/s:11SwiftyMocky9ParameterO">Parameter</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Parameter wraps method attribute, allowing to make a difference between explicit value,
expressed by <code>.value</code> case and wildcard value, expressed by <code>.any</code> case.</p>

<p>Whole idea is to be able to test and specify behaviours, in both generic and explicit way
(and any mix of these two). Every test method matches mock methods in signature, but changes attributes types
to Parameter.</p>

<p>That allows pattern like matching between two Parameter values:</p>

<ul>
<li><strong>.any</strong> is equal to every other parameter. (<strong>!!!</strong> actual case name is <code>._</code>, but it is advised to use <code>.any</code>)</li>
<li><strong>.value(p1)</strong> is equal to <strong>.value(p2)</strong> only, when p1 == p2</li>
</ul>

<p><strong>Important!</strong> Comparing parameters, where ValueType is not Equatable will result in fatalError,
unless you register comparator for its <em>ValueType</em> in <strong>Matcher</strong> instance used (typically Matcher.default)</p>

<ul>
<li>any: represents and matches any parameter value</li>
<li>value: represents explicit parameter value</li>
</ul>

                        <a href="Enums/Parameter.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 swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Parameter</span><span class="o">&lt;</span><span class="kt">ValueType</span><span class="o">&gt;</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
              </ul>
            </div>
            <div class="task-group">
              <ul>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:11SwiftyMocky7MatcherC"></a>
                    <a name="//apple_ref/swift/Class/Matcher" class="dashAnchor"></a>
                    <a class="token" href="#/s:11SwiftyMocky7MatcherC">Matcher</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Matcher is container class, responsible for storing and resolving comparators for given types.</p>

                        <a href="Classes/Matcher.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 swift"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">Matcher</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
              </ul>
            </div>
            <div class="task-group">
              <ul>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:11SwiftyMocky9CountableP"></a>
                    <a name="//apple_ref/swift/Protocol/Countable" class="dashAnchor"></a>
                    <a class="token" href="#/s:11SwiftyMocky9CountableP">Countable</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Allows matching count, verifying whether given count is right or not</p>

                        <a href="Protocols/Countable.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 swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">Countable</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:11SwiftyMocky5CountV"></a>
                    <a name="//apple_ref/swift/Struct/Count" class="dashAnchor"></a>
                    <a class="token" href="#/s:11SwiftyMocky5CountV">Count</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Count object. Use it for all Verify features, when checking how many times something happened.</p>

<p>There are three ways of using it:</p>

<ol>
<li>Explicit literal - you can pass 0, 1, 2 &hellip; to verify exact number</li>
<li>Using init with closure, to specify matching rule like:
 <code>
 Count() { return ... }
</code></li>
<li>Using one of predefined rules, for example:

<ul>
<li>.never</li>
<li>.atLeastOnce</li>
<li>.in(range: 0&hellip;3)</li>
<li>.in(range: 1..&lt;3)</li>
<li>.in(range: 7&hellip;)</li>
<li>.more(than: 2)</li>
<li>.moreOrEqual(to: 3)</li>
<li>.less(than: 2)</li>
<li>.lessOrEqual(to: 1)</li>
</ul></li>
</ol>

                        <a href="Structs/Count.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 swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Count</span> <span class="p">:</span> <span class="kt"><a href="Protocols/Countable.html">Countable</a></span><span class="p">,</span> <span class="kt">ExpressibleByIntegerLiteral</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
              </ul>
            </div>
          </section>
        </section>
        <section id="footer">
          <p>Copyright © 2017 MakeAWishFoundation. All rights reserved.</p>
          <p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.3</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
        </section>
      </article>
    </div>
  </body>
</div>
</html>