<div dir="ltr"><div class="gmail_default" style="font-family:georgia,serif">I think you'd better define your own operator, maybe `=~` or something else. As `==` has already meant something in enum.</div><div class="gmail_default" style="font-family:georgia,serif"><br></div><div class="gmail_default" style="font-family:georgia,serif">Zhaoxin</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 8, 2017 at 5:07 PM, Rien via swift-users <span dir="ltr"><<a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I’d love to know if there is a better way, but a ‘switch’ or 'if case' is the only way I know.<br>
<br>
Regards,<br>
Rien<br>
<br>
Site: <a href="http://balancingrock.nl" rel="noreferrer" target="_blank">http://balancingrock.nl</a><br>
Blog: <a href="http://swiftrien.blogspot.com" rel="noreferrer" target="_blank">http://swiftrien.blogspot.com</a><br>
Github: <a href="http://github.com/Balancingrock" rel="noreferrer" target="_blank">http://github.com/<wbr>Balancingrock</a><br>
Project: <a href="http://swiftfire.nl" rel="noreferrer" target="_blank">http://swiftfire.nl</a> - A server for websites build in Swift<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
<br>
<br>
<br>
> On 08 May 2017, at 11:01, Rick Mann via swift-users <<a href="mailto:swift-users@swift.org">swift-users@swift.org</a>> wrote:<br>
><br>
> Seriously, I've been googling this for a half-hour, and I can't find an answer (everything that comes up is for ErrorType, absolutely nothing for Error).<br>
><br>
> I have an enum:<br>
><br>
> enum MyErrors : Error<br>
> {<br>
> case one(String)<br>
> case two<br>
> case three(String)<br>
> }<br>
><br>
> let a: MyErrors = .one("foo")<br>
> let b = .two<br>
> let c = .towo<br>
><br>
> I want to compare them with ==, and I don't care about the associated types. I can't for the life of me figure out how without an exhaustive switch statement in a == definition. Is that the only way?<br>
><br>
> --<br>
> Rick Mann<br>
> <a href="mailto:rmann@latencyzero.com">rmann@latencyzero.com</a><br>
><br>
><br>
> ______________________________<wbr>_________________<br>
> swift-users mailing list<br>
> <a href="mailto:swift-users@swift.org">swift-users@swift.org</a><br>
> <a href="https://lists.swift.org/mailman/listinfo/swift-users" rel="noreferrer" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-users</a><br>
<br>
______________________________<wbr>_________________<br>
swift-users mailing list<br>
<a href="mailto:swift-users@swift.org">swift-users@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-users" rel="noreferrer" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-users</a><br>
</div></div></blockquote></div><br></div>