<div dir="ltr"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">







<span style="font-size:12.8px">I have a class that specifies a initialiser taking any class that implements the protocol &quot;ChatDatastore&quot;</span><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">I can use this fine in the functions for my test cases.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">However if I try to initialise it in a member either statically, lazily or even via a computed variable it shows an error stating &quot;Instance member &#39;chatDatastore&#39; cannot be used on type &#39;ChatSessionRowViewModelTests&#39;</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Not only is this confusing its plain wrong. I am passing in a Mock which implements this protocol for the purposes of testing.</div><div style="font-size:12.8px"><br></div><p><span style="font-size:12.8px">This should work yet it seems to think that the initializer takes a totally different type than specified in the code. It should accept my Mock class since it implements this protocol yet it complains that I need to give it an instance of my testing class. Which makes no sense :S</span></p><p><b><font color="#cc0000">___________________________________</font></b></p><p><b>James⎥Head Of CEO</b></p><p><b><font color="#cc0000"><a href="mailto:james@supmenow.com" target="_blank">james@supmenow.com</a>⎥<a href="http://supmenow.com" target="_blank">supmenow.com</a></font></b></p><p><b><font size="2">Sup</font></b></p><p><b><font size="2">Runway East
</font></b></p><p><b><font size="2">10 Finsbury Square</font></b></p><p><b><font size="2">London</font></b></p><p><b><font size="2">
EC2A 1AF </font></b></p></div></div></div></div></div></div></div></div></div>
</div>