Bill L Bill L - 2 months ago 161x
Swift Question

Expected ',' joining parts of a multi-clause condition

I'm trying to write a multi-part guard statement like so:

guard let killSwitchedFeatures = quickAuthCardAccount.killswitches, !self.isKillswitched(usingArray: killSwitchedFeatures) else {

However, this gives me the error
Expected ',' joining parts of a multi-clause condition.
Does anyone know why I'm getting this error? I'm still fairly new-ish to Swift, but can see from examples online that this at least used to be possible.

I'm using Xcode 8 beta 5 if that makes any difference

Edit: Here's the definition of the

private func isKillswitched(usingArray killswitchArray: [String]) -> Bool

And here is the definition of the

public let killswitches: [String]?


I think you need to make the second clause (each one after comma) in new line.

I read this article about the change made in swift 3:

This paragraph telling about why keep the comma in same line cause issue:

The ambiguities arise from the fact that there are comma-separated lists within comma-separated lists—within the list of conditions, each 'case' or 'let' condition can have multiple declarations. If we eliminated this feature, so that every 'case' or 'let' condition had to start with 'case' or 'let', the ambiguity is resolved, and comma can remain the condition separator. This does break consistency with non-conditional 'let' declarations and case clauses in 'switch' but is otherwise workable.

Basically it says, this case is confused with if case let = xxx, let = xxx statement.