-1

According to Apple: "A function can have multiple variadic parameters. The first parameter that comes after a variadic parameter must have an argument label."

But when I tried doing the same it is giving me following error. "Only a single variadic parameter '...' is permitted" Please see the attached screenshot

enter image description here

Correction: Actually I was using the older version of XCode which doesn't support Multiple Variadic Parameters.

Developer
  • 6,375
  • 12
  • 58
  • 92
  • 1
    You need to [edit] your question to include all relevant code as text, using proper code formatting - and not as a screenshot -, in the form of a [mcve] in order to make the question on-topic. – Dávid Pásztor May 11 '21 at 09:30
  • What happens if you keep the label on the first parameter? And what version of Xcode are you using? – EmilioPelaez May 11 '21 at 09:30
  • i can't find any issue here. –  May 11 '21 at 10:35

2 Answers2

5

Multiple variadic parameters was only released in Swift 5.4, which comes with Xcode 12.5.

If you are using an older Swift/Xcode version, you need to update to be able to use this feature.

Dávid Pásztor
  • 51,403
  • 9
  • 85
  • 116
0

Multiple variadic parameters was only released in Swift 5.4, or later version

 func goalsOfPlayer(times: Int..., players: String...) {
        for i in times {
            print("times \(i)")
        }
      for j in players {
        print("players \(j)")
      }
    
    }
    
goalsOfPlayer(times: 18, 33, 55, 90, players: "Dani", "Jamie", "Roy")