Or is there a way to somehow have Xcode do autocompletion without the shortened syntax?
Xcode is quite smart. It chooses the non-trailing closure version if you do the auto completion in a control flow statement that needs a {
. For example, if I type:
guard let a = reminders.first
The auto complete shows:
If I choose the highlighted option, I get:
guard let a = reminders.first(where: <#T##(String) throws -> Bool#>)
If I then press enter, I get:
guard let a = reminders.first(where: { (<#String#>) -> Bool in
<#code#>
})
It doesn't turn it into a trailing closure, as long as you autocomplete within a guard/if statement.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…