× {{alert.msg}} Never ask again
Get notified about new tutorials RECEIVE NEW TUTORIALS

consecutive statements on a line must be separated by :

Antonio Bello
Apr 22, 2015
<p>This line:</p> <pre><code>NSURLRequest nsurlReq = NSURLRequest ( URL : urlValue! ); </code></pre> <p>is using Objective C syntax - it should be instead:</p> <pre><code>let nsurlReq: NSURLRequest = NSURLRequest ( URL : urlValue! ) </code></pre> <p>or, taking advantage of type inference:</p> <pre><code>let nsurlReq = NSURLRequest(URL: urlValue!) </code></pre> <p>Note: I've used <code>let</code> instead of <code>var</code> because I presume <code>nsurlReq</code> won't be modified after its initial assignment, so it's better to make it immutable. Change to mutable otherwise.</p> <p>This tip was originally posted on <a href="http://stackoverflow.com/questions/29703797/consecutive%20statements%20on%20a%20line%20must%20be%20separated%20by%20:/29703817">Stack Overflow</a>.</p>
comments powered by Disqus