title: Mocking in Swift
body: <p>How do you mock an object in Swift?</p>
  <p>The <code>Mirror</code> protocol sounded promising, but it doesn't do much right now.</p>
  <p>So far the only approach I found is to subclass and override all methods of the mocked class. This is of course not a true mock, far from ideal, and a lot of work.</p>
  <p>Any other ideas?</p>
  <h1>Why not OCMock?</h1>
  <p>From the <a href="http://ocmock.org/swift/" rel="noreferrer">source</a>:</p>
  <blockquote>
  <p>Can I use OCMock using the language bridge functionality?</p>
  <p>Yes, but
  with limitations. If you are brave. As of now this is highly
  experimental. There's no guarantee that OCMock will ever fully support
  Swift.</p>
  </blockquote>
  <p>Known limitations:</p>
  <ul>
  <li>Tests have to be written in Objective-C</li>
  <li>Objects that should be mocked must inherit from NSObject</li>
  <li>No stubbing/expecting/verifying of class methods</li>
  </ul>