<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>It may also work if you create a "generic" extension that can
      only be applied to strings.</p>
    <p>Then i'm guessing that you will not need to specify the type on
      the use.</p>
    <p>LF<br>
    </p>
    <p><br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 13/10/2016 22:44, Nevin
      Brackett-Rozinsky via swift-users wrote:<br>
    </div>
    <blockquote
cite="mid:CAK9u92NnKSYpwm3ZcKGF3-vVyY5ymX2MSKWxj9+_ErZC8apS4A@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>It works if you specify the types of the variables:</div>
        <div><br>
        </div>
        let a: String = …
        <div>if let b: String = …</div>
        <div><br>
        </div>
        <div>Nevin</div>
        <div><br>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Thu, Oct 13, 2016 at 5:36 PM, Rick
          Mann via swift-users <span dir="ltr">&lt;<a
              moz-do-not-send="true" href="mailto:swift-users@swift.org"
              target="_blank">swift-users@swift.org</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">It seems I
            can write this:<br>
            <br>
            extension String<br>
            {<br>
              public func deleting(prefix inPrefix: String) -&gt; String<br>
              public func deleting(prefix inPrefix: String) -&gt;
            String?<br>
            }<br>
            <br>
            But I was hoping it would do the right thing:<br>
            <br>
            let a = s.deleting(prefix: "foo")<br>
            if let b = s.deleting(prefix: "foo") { }<br>
            <br>
            But it finds these ambiguous, and I'm not sure how to
            specify which I want.<br>
            <br>
            I'm having trouble googling for an answer on this. Some
            answers around generics, but that doesn't apply in this
            case.<br>
            <span class="HOEnZb"><font color="#888888"><br>
                --<br>
                Rick Mann<br>
                <a moz-do-not-send="true"
                  href="mailto:rmann@latencyzero.com">rmann@latencyzero.com</a><br>
                <br>
                <br>
                ______________________________<wbr>_________________<br>
                swift-users mailing list<br>
                <a moz-do-not-send="true"
                  href="mailto:swift-users@swift.org">swift-users@swift.org</a><br>
                <a moz-do-not-send="true"
                  href="https://lists.swift.org/mailman/listinfo/swift-users"
                  rel="noreferrer" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-users</a><br>
              </font></span></blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
swift-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:swift-users@swift.org">swift-users@swift.org</a>
<a class="moz-txt-link-freetext" href="https://lists.swift.org/mailman/listinfo/swift-users">https://lists.swift.org/mailman/listinfo/swift-users</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>