Xcode Swift compiler warning will never be executed
<p>I have code in this vein:</p>

<pre><code>enum enumThingType {
    case apples
    case oranges
    case starfruit
}

func myFunc( enumThing: enumThingType ) -&gt; String {
    switch enumThing {
    case .apples:
        return "Hey, apples"
    case .oranges:
        return "Hey, oranges"        
    default:
        return ""
    }
}
</code></pre>

<p>I'm very slowly filling in the code for all of the cases, and I have need of the code to be functional while I code for <em>starfruit</em> and its ilk.</p>

<p>All is good, but the compiler issues the warning <strong>will never be executed</strong> for <code>return ""</code>. It happily generates an executable, but I am compulsive and would like warnings and errors to go away.</p>

<p>If I delete the line <code>return ""</code>, then I get the very real and compiler arresting <strong>Missing return in a function expected to return 'String'</strong>.</p>

<p>Likewise, if I just delete <code>default:</code>..., I get the equally arresting error <strong>Switch must be exhaustive, consider adding a default clause</strong>, which is fully understandable, but I am creative in my efforts to thwart warnings and errors.</p>

<p>So given this construct, can I eliminate warnings and errors while still coding for existing cases for <code>myFunc</code>?</p>

<p><strong>EDIT</strong></p>

<p>As @appzYourLife pointed out, I omitted precompiler directives in my sample code that were creating the error. This code, with the precompiler directives, throws a warning:</p>

<pre><code>enum enumThingType {
    case apples
    case oranges
    case starfruit
}

func myFunc( enumThing: enumThingType ) -&gt; String {
    switch enumThing {
    case .apples:
        return "Hey, apples"
    case .oranges:
        return "Hey, oranges"        
    default:
    #if DEBUG
        print( "Ouch!" )
    #else
        fatalError()
    #endif
        return ""
    }
}
</code></pre>

<p>Because if the product is not created with DEBUG specified, then return can never happen--the <code>FatalError()</code> prevents that.</p>

<p>This code, however, <em>does not</em> throw a warning for all precompiler specified cases:</p>

<pre><code>func myFunc( enumThing: enumThingType ) -&gt; String {
    switch enumThing {
    case .apples:
        return "Hey, apples"
    case .oranges:
        return "Hey, oranges"        
    default:
    #if DEBUG
        print( "Ouch!" )
        return ""
    #else
        fatalError()
    #endif
    }
}
</code></pre>

<p>I just wanted to summarize the actual code fix for anyone who might gander across this, as the lack of a properly specified DEBUG flag fixed it for a DEBUG condition, but not for a non DEBUG condition. Thanks again for everyone who helped on this!</p>