Swift requires trailing closures to have their opening bracket on the same line as the function call

Originator:tony
Number:rdar://17500778 Date Originated:30-Jun-2014 11:09 AM
Status:Open Resolved:
Product:OS X Product Version:
Classification:Performance Reproducible:Always
 
Summary:
Swift requires trailing closures to have their opening bracket on the same line as the function call

Steps to Reproduce:

Given the following function signature in Swift: 

func searchForImagesWithQuery(query: String, count: Int, offset: Int, completion: (results: Array<ImageSearchResult>) -> Void);

I would expect to be able to place the brackets on a newline:

self.searchAPIRequest.searchForImagesWithQuery(request.query, count: 25, offset: 0) 
{
	request.results = $0
}


Expected Results:
The code should compile just fine.

Actual Results:
The compiler in Xcode shows the following errors:

“Missing argument for parameter 'completion' in call” and “error: braced block of statements is an unused closure”


Placing the brackets on the same line as the function call works, but isn’t ideal for my style. Thanks guys!

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!