Why can't I use the new inline #imageLiteral syntax in Xcode 8? "Expected expression in return result"
<p>I'm trying to use the new <code>#imageLiteral</code> inline image assignment from your assets folder in Xcode 8, where instead of the whole <code>UIImage(named: "")</code> syntax it's just the image displayed, <a href="https://stackoverflow.com/questions/39610994/xcode-8-image-completion">as shown here</a>.</p>

<p>But when I do, I get the error "Expected expression in return result" when it's a function.</p>

<p>Here's a simple example:</p>

<pre><code>func img() -&gt; UIImage {
    return #imageLiteral(resourceName: "small-checkmark")
}
</code></pre>

<p>Where in Xcode it displays the <code>small-checkmark</code> as would be expected, but it won't compile due to the above error. Everything is autocompleted for me, the file is in the assets folder (a PDF). I don't understand what's going wrong. If I just return <code>UIImage()</code> it compiles fine.</p>

<p>What should I be doing?</p>